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