The installation guide I wrote previously does not work anymore due to some issues with the latest versions of Android NDK and SDK.
Lazarus 1.8.0RC5 + LAMW
http://forum.lazarus.freepascal.org/index.php/topic,38777.0.htmlSo I write this new installation guide, which has been tested to work on:
- Ubuntu Mate 18.04 64-bit
- Lazarus 1.8.4 64-bit GTK2 FPC 3.0.4
- Lazarus Android Module Wizard 0.8 revision 754
- Android 7 mobile phone
This installation uses the combination of these software:
- Android NDK Revision 11c
- Android SDK Tools 25.2.5 (SDK API25)
- OpenJDK 8
- Subversion, Android adb, Ant
If you want to see the screenshots during this installation process, you can visit here:
http://graphicslearning.com/lamw-0-8-ubuntu-18-04-installation-guide/Note:
This installation guide is in CC0 Public Domain, you can republish this article or do anything you like with it.
=== Before Start Installing ===You need to have Lazarus and FPC installed that have the ability to do cross compiling. The Lazarus/FPC installed from Ubuntu default repository may fail to cross compile because of missing make files issue.
If you have LAMW installed previously, you have to uninstall all the related packages and remove the ~/Android folder in your computer.
In this installation guide, the texts in
green color mean you need to type them in your
Linux Terminal.
=== Download and Install Android NDK, SDK and Required Packages ===Warning:
The total size of the items you're going to download in this "Download and Install Android NDK, SDK and Required Packages" section is about 2.2 GB, so you better use a fast internet connection.01.
sudo apt-get install subversion openjdk-8-jdk02.
sudo apt-get install android-tools-adb ant03.
mkdir ~/Android04.
cd ~/Android05.
mkdir ~/Android/sdk06. Download NDK Revision 11c from:
https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip07. Extract android-ndk-r11c-linux-x86_64.zip to ~/Android
08. Download SDK Tools 25.2.5 from:
https://dl.google.com/android/repository/tools_r25.2.5-linux.zip09. Extract tools_r25.2.5-linux.zip to ~/Android/sdk
10.
cd ~/Android/sdk/tools11.
./android12. Click Deselect All
13. Inside the Tools group
Check
Android SDK Platform-toolsCheck
Android SDK Build-tools Rev. 2514. Scroll down to find Android 7.1.1 (API25)
Check
SDK Platform Check
Google APIs ARM EABI v7a System Image15. Click Install 4 packages...
16.
ln -sf ~/Android/android-ndk-r11c ~/Android/ndk17.
cd /usr/bin18.
sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as arm-linux-androideabi-as19.
sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld arm-linux-androideabi-ld20.
sudo ln -sf /usr/bin/arm-linux-androideabi-as arm-linux-as21.
sudo ln -sf /usr/bin/arm-linux-androideabi-ld arm-linux-ld22. Use a text editor to open ~/.bashrc and add this blue text below:
export PATH=$PATH:~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin=== Cross Compile Android ARM ===23.
cd /usr/share/fpcsrc/3.0.424.
sudo make clean crossall OS_TARGET=android CPU_TARGET=arm25.
sudo make crossinstall OS_TARGET=android CPU_TARGET=arm INSTALL_PREFIX=/usr26.
sudo ln -sf /usr/lib/fpc/3.0.4/ppcrossarm /usr/bin/ppcrossarm27.
sudo ln -sf /usr/bin/ppcrossarm /usr/bin/ppcarm28. Add these blue lines below to your /etc/fpc.cfg:
#IFDEF ANDROID
#IFDEF CPUARM
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
#ENDIF
#ENDIF=== Lazarus Android Module Wizard Installation ===For the steps #
33, #
35, #
37 below, the *.lpk files are inside
~/Android/lazandroidmodulewizard.git/trunkYou need to change the text
[handoko] with the current username on your computer.
29.
cd ~/Android30.
svn co https://github.com/jmpessoa/lazandroidmodulewizard.git31.
ln -sf ~/Android/lazandroidmodulewizard.git ~/Android/lazandroidmodulewizard32. Start Lazarus IDE
33. Menu > Package > Open Package File (.lpk)
Select .../android_bridges/
tfpandroidbride_pack.lpk34. Compile, then and Use > Install > No
35. Menu > Package > Open Package File (.lpk)
Select .../android_wizard/
lazandroidwizardpack.lpk36. Compile, then and Use > Install > No
37. Menu > Package > Open Package File (.lpk)
Select .../ide_tools/
amw_ide_tools.lpk38. Compile, then and Use > Install >
Yes39. Start Lazarus IDE
40. Menu > Tools > [Lamw] Android Module Wizard > Paths Settings: [Jdk, Sdk, Ndk, ...]:
Path to Java JDK:
/usr/lib/jvm/java-8-openjdk-amd64Path to Ant bin:
/usr/binPath to Android SDK:
/home/[handoko]/Android/sdkPath to Android NDK:
/home/[handoko]/Android/ndkPath to [LAMW] Java Templates:
/home/[handoko]/Android/lazandroidmodulewizard.git/trunk/javaNDK Version:
11cNDK [prebuild] System:
linux-x86_64