LAMW install windows fpcupdeluxe: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Install LAMW and Android Development Environment on Windows using [fpcupdeluxe](https://wiki.freepascal.org/fpcupdeluxe) | |
| 2 | 2 | ||
| 3 | 3 | See also | |
| 4 | 4 | ||
| 5 | - | ||
| 6 | - | ||
| 5 | + | ```text | |
| 6 | + | Forum Post: https://forum.lazarus.freepascal.org/index.php?topic=59226 | |
| 7 | + | For Linux How-To see here: https://wiki.freepascal.org/LAMW_install_linux_fpcupdeluxe | |
| 8 | + | ``` | |
| 7 | 9 | ||
| 8 | - | ||
| 9 | - | ||
| 10 | + | ```text | |
| 11 | + | https://wiki.freepascal.org/LAMW | |
| 12 | + | https://wiki.freepascal.org/fpcupdeluxe | |
| 13 | + | ``` | |
| 10 | 14 | ||
| 11 | - | ||
| 12 | - | ||
| 15 | + | ```text | |
| 16 | + | As of 2023-Feb-06, this error is still happening: | |
| 17 | + | https://forum.lazarus.freepascal.org/index.php/topic,21919.msg441567.html#msg441567 | |
| 18 | + | ``` | |
| 13 | 19 | ||
| 14 | 20 | Motivation | |
| 15 | 21 | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 22 | + | ```text | |
| 23 | + | Needed simple instructions to get an up-to-date Android build environment setup on Windows. | |
| 24 | + | (installs and runs as a user, no admin privileges are needed) | |
| 25 | + | Thanks to other developers for sharing their hard work, utilities, and helpful information. | |
| 26 | + | ``` | |
| 19 | 27 | ||
| 20 | 28 | Everything is self-contained under the "\$BASE\android" folder | |
| 21 | 29 | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 30 | + | ```text | |
| 31 | + | ($BASE defaults to the user's home folder) | |
| 32 | + | $BASE\android\sdk (android sdk and build tools) | |
| 33 | + | $BASE\android\sdk\ndk-bundle (android ndk) | |
| 34 | + | $BASE\android\fpcupdeluxe_app (FPCUPdeluxe installer) | |
| 35 | + | $BASE\android\projects (default LAMW projects folder) | |
| 36 | + | $BASE\android\fpc-lazarus (FPC, Lazarus built w/ LAMW) | |
| 37 | + | $BASE\android\fpc-lazarus\ccr\lamw (LAMW files) | |
| 38 | + | $BASE\android\fpc-lazarus\ccr\lamw-gradle (gradle build tool) | |
| 39 | + | $BASE\android\fpc-lazarus\ccr\lamw\demos (LAMW demo projects) | |
| 40 | + | ``` | |
| 31 | 41 | ||
| 32 | 42 | Versions Tested | |
| 33 | 43 | ||
| 34 | - | ||
| 44 | + | ``` pascal | |
| 45 | + | Windows 10 Pro 22H2 64-bit with latest updates installed | |
| 35 | 46 | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 47 | + | Android Command-Line Tools for Linux build 9477386 | |
| 48 | + | OpenJDK 11.0.18 LTS (Microsoft's build) | |
| 49 | + | Android SDK/API Level 31 (Android 12) | |
| 50 | + | Android NDK revision 22 | |
| 51 | + | Gradle 6.8.3 (installed automatically by FPCUPdeluxe) | |
| 41 | 52 | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 53 | + | FPCUPdeluxe ver 2.2.0n | |
| 54 | + | FPC stable v3.2.2 | |
| 55 | + | Lazarus stable v2.2.4 | |
| 45 | 56 | ||
| 46 | - | ||
| 47 | - | ||
| 57 | + | 32-bit CPU Target: ARMv7a + VFPv3 (hardware floating point) | |
| 58 | + | 64-bit CPU Target: Aarch64 (this always uses hardware floating point) | |
| 59 | + | ``` | |
| 48 | 60 | ||
| 49 | 61 | ## Main steps begin here | |
| 50 | 62 | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 63 | + | ```text | |
| 54 | 64 | ||
| 65 | + | Run these commands in a non-admin powershell console. I recommend running these | |
| 66 | + | one at a time so you can verify the results before moving on to the next step. | |
| 67 | + | ``` | |
| 68 | + | ||
| 55 | 69 | ``` powershell | |
| 56 | 70 | # (powershell code) | |
| 57 | 71 | # Setup Android Development Environment on Windows (FPCUPdeluxe / LAMW) | |
| 58 | 72 | # Tested on Windows 10 Pro 22H2 64-bit | |
| 59 | 73 | # Targets: 32-bit ARMv7a and 64-bit Aarch64 | |
| 60 | 74 | # 2023-Feb-05 ver 0.7 | |
| 61 | 75 | ||
| 62 | 76 | $BASE = "$HOME" #change this if you want to install to a different location | |
| 63 | 77 | $ProgressPreference = 'SilentlyContinue' # hide progress for faster downloads | |
| 64 | 78 | $PSDefaultParameterValues=@{'out-file:encoding'='ascii'} #set text redirection to file as ascii | |
| 65 | 79 | ||
| 66 | 80 | # Install OpenJDK | |
| 67 | 81 | # https://docs.microsoft.com/en-us/java/openjdk/download | |
| 68 | 82 | md "$BASE\android" | |
| 69 | 83 | cd "$BASE\android" | |
| 70 | 84 | Invoke-WebRequest "https://aka.ms/download-jdk/microsoft-jdk-11.0.18-windows-x64.zip" -OutFile "microsoft-jdk-Win-x64.zip" | |
| 71 | 85 | Expand-Archive "microsoft-jdk-Win-x64.zip" ".\" | |
| 72 | 86 | del "microsoft-jdk-Win-x64.zip" | |
| 73 | 87 | ||
| 74 | 88 | # Setup java environment for current process | |
| 75 | 89 | ${env:JAVA_HOME} = "$BASE\android\jdk-11.0.18+10" | |
| 76 | 90 | ${env:Path} = "${env:JAVA_HOME}\bin;" + ${env:Path} | |
| 77 | 91 | ||
| 78 | 92 | # Setup java environment for current user | |
| 79 | 93 | # (this makes it persistent across reboots) | |
| 80 | 94 | [Environment]::SetEnvironmentVariable("JAVA_HOME", "${env:JAVA_HOME}", "User") | |
| 81 | 95 | $UserPath = "${env:JAVA_HOME}\bin;" + [Environment]::GetEnvironmentVariable("Path", "User") | |
| 82 | 96 | [Environment]::SetEnvironmentVariable("Path", $UserPath, "User") | |
| 83 | 97 | ||
| 84 | 98 | # Download and extract Android SDK Command Line Tools for Windows | |
| 85 | 99 | # https://developer.android.com/studio/#downloads | |
| 86 | 100 | md "$BASE\android\sdk\cmdline-tools" | |
| 87 | 101 | cd "$BASE\android\sdk\cmdline-tools" | |
| 88 | 102 | Invoke-WebRequest "https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip" -OutFile "commandlinetools-win.zip" | |
| 89 | 103 | Expand-Archive "commandlinetools-win.zip" ".\" | |
| 90 | 104 | ren "cmdline-tools" "latest" | |
| 91 | 105 | del "commandlinetools-win.zip" | |
| 92 | 106 | ||
| 93 | 107 | # Install SDK packages and NDK | |
| 94 | 108 | cd "$BASE\android\sdk\cmdline-tools/latest/bin" | |
| 95 | 109 | @('y','y','y','y','y','y','y','y','y','y') | ./sdkmanager --licenses | |
| 96 | 110 | # (Note: to view a list of available packages use .\sdkmanager --list) | |
| 97 | 111 | .\sdkmanager "platforms;android-31" "build-tools;31.0.0" "tools" "ndk;22.1.7171670" "extras;android;m2repository" | |
| 98 | 112 | ||
| 99 | 113 | # Download FPCUPdeluxe from https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/latest | |
| 100 | 114 | # (tested with version 2.2.0n) | |
| 101 | 115 | md "$BASE\android\fpcupdeluxe_app" | |
| 102 | 116 | cd "$BASE\android\fpcupdeluxe_app" | |
| 103 | 117 | Invoke-WebRequest "https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.2.0n/fpcupdeluxe-x86_64-win64.exe" -OutFile "fpcupdeluxe-x86_64-win64.exe" | |
| 104 | 118 | "[General]" > fpcupdeluxe.ini | |
| 105 | 119 | "InstallDirectory=$BASE\android\fpc-lazarus" >> fpcupdeluxe.ini | |
| 106 | 120 | .\fpcupdeluxe-x86_64-win64.exe | |
| 107 | 121 | ||
| 108 | 122 | # Using the FPCUPdeluxe GUI | |
| 109 | 123 | # (The install path is already set. e.g. c:\users\[your_user]\android\fpc-lazarus) | |
| 110 | 124 | # | |
| 111 | 125 | # 1) At the bottom of the main Window, click the "LAMW" button | |
| 112 | 126 | # | |
| 113 | 127 | # As of 2023-Feb-05, this installs stable FPC (3.2.2), stable Lazarus (v2.2.4), cross | |
| 114 | 128 | # compilers for arm/android and aarch64/android, gradle v6.8.3, and latest LAMW from git. | |
| 115 | 129 | # | |
| 116 | 130 | # 2) (Optional) On modules tab click the "OPM" button to install Online Package Manager. | |
| 117 | 131 | # 3) Close FPCUPdeluxe | |
| 118 | 132 | ||
| 119 | 133 | # Change name for the desktop shortcut | |
| 120 | 134 | # (this works if $BASE = $HOME, otherwise rename the desktop shortcut manually) | |
| 121 | 135 | ren "$BASE\Desktop\Lazarus_fpc-lazarus.lnk" "Lazarus LAMW.lnk" | |
| 122 | 136 | ||
| 123 | 137 | # Create a directory for android projects | |
| 124 | 138 | md "$BASE\android\projects" | |
| 125 | 139 | ||
| 126 | 140 | # Edit LAMW settings via the ini file | |
| 127 | 141 | $LAMWini="$BASE\android\fpc-lazarus\config_lazarus\LAMW.ini" | |
| 128 | 142 | (Get-Content $LAMWini | Select-String -pattern "PathToWorkspace" -notmatch) | Set-Content $LAMWini | |
| 129 | 143 | "PathToWorkspace=$BASE\android\projects" >> $LAMWini | |
| 130 | 144 | "PathToAndroidSDK=$BASE\android\sdk" >> $LAMWini | |
| 131 | 145 | "PathToAndroidNDK=$BASE\android\sdk\ndk\22.1.7171670" >> $LAMWini | |
| 132 | 146 | "NDK=6" >> $LAMWini | |
| 133 | 147 | ||
| 134 | 148 | # After launching Lazarus-LAMW, you can confirm paths and settings in | |
| 135 | 149 | # the Tools | [LAMW] Android Module Wizard | Path Settings menu | |
| 136 | 150 | ``` | |
| 137 | 151 | ||
| 138 | 152 | For new LAMW projects | |
| 139 | 153 | ||
| 140 | - | ||
| 141 | - | ||
| 142 | - | ||
| 143 | - | ||
| 154 | + | ```text | |
| 155 | + | for 32-bit: ARMv7a + VFPv3 for Architecture/Instructions | |
| 156 | + | for 64-bit: Aarch64 for Architecture/Instructions | |
| 157 | + | Min. Device API: 19 (Google recommended minimum SDK version) | |
| 158 | + | See here: https://android-developers.googleblog.com/2021/07/google-play-services-discontinuing-jelly-bean.html | |
| 159 | + | ``` | |
| 144 | 160 | ||
| 145 | 161 | For demo LAMW projects | |
| 146 | 162 | ||
| 147 | - | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - | ||
| 151 | - | ||
| 163 | + | ```text | |
| 164 | + | (Project | Open Project) Open the controls.lpi file in the demo project jni folder | |
| 165 | + | If it asks for a Target API change enter 31 for the target. | |
| 166 | + | for 32-bit: Change LAMW project options | Min SDK: 19 and Build tab | Chipset: ARMv7a+VFPv3 | |
| 167 | + | for 64-bit: Change LAMW project options | Min SDK: 19 and Build tab | Chipset: Aarch64 | |
| 168 | + | Perform a Run | Clean up and Build | |
| 169 | + | ``` | |
| 152 | 170 | ||
| 153 | 171 | Changes | |
| 154 | 172 | ||
| 155 | - | ||
| 156 | - | ||
| 157 | - | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - | ||
| 173 | + | ```text | |
| 174 | + | 2023-Feb-05 ver 0.7 | |
| 175 | + | Use $BASE for installation directory (defaults to $HOME) | |
| 176 | + | Tested on Win10 Pro 22H2 64-bit | |
| 177 | + | Android Command-Line Tools for Linux build 9477386 | |
| 178 | + | OpenJDK 11.0.18 LTS (Microsoft's build) | |
| 179 | + | Gradle 6.8.3 (installed automatically by FPCUPdeluxe) | |
| 180 | + | FPCUPdeluxe ver 2.2.0n | |
| 181 | + | Lazarus stable v2.2.4 | |
| 182 | + | ``` | |
| 163 | 183 | ||
| 164 | - | ||
| 165 | - | ||
| 166 | - | ||
| 167 | - | ||
| 168 | - | ||
| 169 | - | ||
| 170 | - | ||
| 171 | - | ||
| 184 | + | ```text | |
| 185 | + | 2022-May-01 ver 0.6 - Initial release | |
| 186 | + | Tested on Win10 Pro 21H2 64-bit | |
| 187 | + | Android Command-Line Tools for Linux build 8092744 | |
| 188 | + | OpenJDK 11.0.14 LTS (Microsoft's build) | |
| 189 | + | Gradle 7.3.1 (installed automatically by FPCUPdeluxe) | |
| 190 | + | FPCUPdeluxe ver 2.2.0i | |
| 191 | + | FPC stable v3.2.2 | |
| 192 | + | Lazarus stable v2.2.0 | |
| 193 | + | ``` | |
| 172 | 194 | ||
| 173 | 195 | --- | |
| 174 | 196 | *From the Free Pascal wiki, page "LAMW install windows fpcupdeluxe", as it stood on 2023-02-07 after a change by WayneSherman, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
