Sign in Join
Wiki copytemporary

LAMW install windows fpcupdeluxe: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Install LAMW and Android Development Environment on Windows using [fpcupdeluxe](https://wiki.freepascal.org/fpcupdeluxe)
22
33See also
44
55`Forum Post: `[`https://forum.lazarus.freepascal.org/index.php?topic=59226`](https://forum.lazarus.freepascal.org/index.php?topic=59226)\
66`For Linux How-To see here: `[`https://wiki.freepascal.org/LAMW_install_linux_fpcupdeluxe`](https://wiki.freepascal.org/LAMW_install_linux_fpcupdeluxe)
77
88[`https://wiki.freepascal.org/LAMW`](https://wiki.freepascal.org/LAMW)\
99[`https://wiki.freepascal.org/fpcupdeluxe`](https://wiki.freepascal.org/fpcupdeluxe)
1010
1111`As of 2023-Feb-06, this error is still happening:`\
1212[`https://forum.lazarus.freepascal.org/index.php/topic,21919.msg441567.html#msg441567`](https://forum.lazarus.freepascal.org/index.php/topic,21919.msg441567.html#msg441567)
1313
1414Motivation
1515
1616`Needed simple instructions to get an up-to-date Android build environment setup on Windows.`\
1717`(installs and runs as a user, no admin privileges are needed)`\
1818`Thanks to other developers for sharing their hard work, utilities, and helpful information.`
1919
2020Everything is self-contained under the "\$BASE\android" folder
2121
2222`($BASE defaults to the user's home folder)`\
2323`$BASE\android\sdk  (android sdk and build tools)`\
2424`$BASE\android\sdk\ndk-bundle  (android ndk)`\
2525`$BASE\android\fpcupdeluxe_app  (FPCUPdeluxe installer)`\
2626`$BASE\android\projects  (default LAMW projects folder)`\
2727`$BASE\android\fpc-lazarus  (FPC, Lazarus built w/ LAMW)`\
2828`$BASE\android\fpc-lazarus\ccr\lamw  (LAMW files)`\
2929`$BASE\android\fpc-lazarus\ccr\lamw-gradle  (gradle build tool)`\
3030`$BASE\android\fpc-lazarus\ccr\lamw\demos (LAMW demo projects)`
3131
3232Versions Tested
3333
3434`Windows 10 Pro 22H2 64-bit with latest updates installed`\
35-\
35+
3636`Android Command-Line Tools for Linux build 9477386`\
3737`OpenJDK 11.0.18 LTS (Microsoft's build)`\
3838`Android SDK/API Level 31 (Android 12)`\
3939`Android NDK revision 22`\
4040`Gradle 6.8.3 (installed automatically by FPCUPdeluxe)`\
41-\
41+
4242`FPCUPdeluxe ver 2.2.0n`\
4343`FPC stable v3.2.2`\
4444`Lazarus stable v2.2.4`\
45-\
45+
4646`32-bit CPU Target: ARMv7a + VFPv3 (hardware floating point)`\
4747`64-bit CPU Target: Aarch64 (this always uses hardware floating point)`
4848
4949## Main steps begin here
5050
5151``\
5252`Run these commands in a non-admin powershell console.  I recommend running these`\
5353`one at a time so you can verify the results before moving on to the next step.`
5454
5555``` powershell
5656# (powershell code)
5757# Setup Android Development Environment on Windows (FPCUPdeluxe / LAMW)
5858# Tested on Windows 10 Pro 22H2 64-bit
5959# Targets: 32-bit ARMv7a and 64-bit Aarch64
6060# 2023-Feb-05 ver 0.7
6161
6262$BASE = "$HOME" #change this if you want to install to a different location
6363$ProgressPreference = 'SilentlyContinue' # hide progress for faster downloads
6464$PSDefaultParameterValues=@{'out-file:encoding'='ascii'} #set text redirection to file as ascii
6565
6666# Install OpenJDK
6767# https://docs.microsoft.com/en-us/java/openjdk/download
6868md "$BASE\android"
6969cd "$BASE\android"
7070Invoke-WebRequest "https://aka.ms/download-jdk/microsoft-jdk-11.0.18-windows-x64.zip" -OutFile "microsoft-jdk-Win-x64.zip"
7171Expand-Archive "microsoft-jdk-Win-x64.zip" ".\"
7272del "microsoft-jdk-Win-x64.zip"
7373
7474# Setup java environment for current process
7575${env:JAVA_HOME} = "$BASE\android\jdk-11.0.18+10"
7676${env:Path} = "${env:JAVA_HOME}\bin;" + ${env:Path}
7777
7878# Setup java environment for current user
7979# (this makes it persistent across reboots)
8080[Environment]::SetEnvironmentVariable("JAVA_HOME", "${env:JAVA_HOME}", "User")
8181$UserPath = "${env:JAVA_HOME}\bin;" + [Environment]::GetEnvironmentVariable("Path", "User")
8282[Environment]::SetEnvironmentVariable("Path", $UserPath, "User")
8383
8484# Download and extract Android SDK Command Line Tools for Windows
8585# https://developer.android.com/studio/#downloads
8686md "$BASE\android\sdk\cmdline-tools"
8787cd "$BASE\android\sdk\cmdline-tools"
8888Invoke-WebRequest "https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip" -OutFile "commandlinetools-win.zip"
8989Expand-Archive "commandlinetools-win.zip" ".\"
9090ren "cmdline-tools" "latest"
9191del "commandlinetools-win.zip"
9292
9393# Install SDK packages and NDK
9494cd "$BASE\android\sdk\cmdline-tools/latest/bin"
9595@('y','y','y','y','y','y','y','y','y','y') | ./sdkmanager --licenses
9696# (Note: to view a list of available packages use .\sdkmanager --list)
9797.\sdkmanager "platforms;android-31" "build-tools;31.0.0" "tools" "ndk;22.1.7171670" "extras;android;m2repository"
9898
9999# Download FPCUPdeluxe from https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/latest
100100# (tested with version 2.2.0n)
101101md "$BASE\android\fpcupdeluxe_app"
102102cd "$BASE\android\fpcupdeluxe_app"
103103Invoke-WebRequest "https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.2.0n/fpcupdeluxe-x86_64-win64.exe" -OutFile "fpcupdeluxe-x86_64-win64.exe"
104104"[General]" > fpcupdeluxe.ini
105105"InstallDirectory=$BASE\android\fpc-lazarus" >> fpcupdeluxe.ini
106106.\fpcupdeluxe-x86_64-win64.exe
107107
108108# Using the FPCUPdeluxe GUI
109109# (The install path is already set. e.g. c:\users\[your_user]\android\fpc-lazarus)
110110#
111111# 1) At the bottom of the main Window, click the "LAMW" button
112112#
113113# As of 2023-Feb-05, this installs stable FPC (3.2.2), stable Lazarus (v2.2.4), cross
114114# compilers for arm/android and aarch64/android, gradle v6.8.3, and latest LAMW from git.
115115#
116116# 2) (Optional) On modules tab click the "OPM" button to install Online Package Manager.
117117# 3) Close FPCUPdeluxe
118118
119119# Change name for the desktop shortcut
120120# (this works if $BASE = $HOME, otherwise rename the desktop shortcut manually)
121121ren "$BASE\Desktop\Lazarus_fpc-lazarus.lnk" "Lazarus LAMW.lnk"
122122
123123# Create a directory for android projects
124124md "$BASE\android\projects"
125125
126126# Edit LAMW settings via the ini file
127127$LAMWini="$BASE\android\fpc-lazarus\config_lazarus\LAMW.ini"
128128(Get-Content $LAMWini | Select-String -pattern "PathToWorkspace" -notmatch) | Set-Content $LAMWini
129129"PathToWorkspace=$BASE\android\projects" >> $LAMWini
130130"PathToAndroidSDK=$BASE\android\sdk" >> $LAMWini
131131"PathToAndroidNDK=$BASE\android\sdk\ndk\22.1.7171670" >> $LAMWini
132132"NDK=6" >> $LAMWini
133133
134134# After launching Lazarus-LAMW, you can confirm paths and settings in
135135# the Tools | [LAMW] Android Module Wizard | Path Settings menu
136136```
137137
138138For new LAMW projects
139139
140140`for 32-bit:  ARMv7a + VFPv3 for Architecture/Instructions`\
141141`for 64-bit:  Aarch64 for Architecture/Instructions`\
142142`Min. Device API: 19  (Google recommended minimum SDK version)`\
143143`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)
144144
145145For demo LAMW projects
146146
147147`(Project | Open Project) Open the controls.lpi file in the demo project jni folder`\
148148`If it asks for a Target API change enter 31 for the target.`\
149149`for 32-bit:  Change LAMW project options | Min SDK: 19 and Build tab | Chipset: ARMv7a+VFPv3`\
150150`for 64-bit:  Change LAMW project options | Min SDK: 19 and Build tab | Chipset: Aarch64`\
151151`Perform a Run | Clean up and Build`
152152
153153Changes
154154
155155`2023-Feb-05 ver 0.7`\
156156` Use $BASE for installation directory (defaults to $HOME)`\
157157` Tested on Win10 Pro 22H2 64-bit`\
158158` Android Command-Line Tools for Linux build 9477386`\
159159` OpenJDK 11.0.18 LTS (Microsoft's build)`\
160160` Gradle 6.8.3 (installed automatically by FPCUPdeluxe)`\
161161` FPCUPdeluxe ver 2.2.0n`\
162162` Lazarus stable v2.2.4`
163163
164164`2022-May-01 ver 0.6 - Initial release`\
165165` Tested on Win10 Pro 21H2 64-bit`\
166166` Android Command-Line Tools for Linux build 8092744`\
167167` OpenJDK 11.0.14 LTS (Microsoft's build)`\
168168` Gradle 7.3.1 (installed automatically by FPCUPdeluxe)`\
169169` FPCUPdeluxe ver 2.2.0i`\
170170` FPC stable v3.2.2`\
171171` Lazarus stable v2.2.0`
172172
173173---
174174*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).*

Back to history