Sign in Join
Wiki copytemporary

LAMW install windows fpcupdeluxe: what changed

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

Title: LAMW install windows fpcupdeluxe

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

Back to history