LAMW 0.8 Ubuntu 18.04 Installation Guide

This Lazarus Android Module Wizard 0.8 Ubuntu 18.04 Installation Guide has been tested 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

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

 

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. You can get Lazarus/FPC from its official website: http://www.lazarus-ide.org/

If you have LAMW (Lazarus Android Module Wizard) installed previously, you have to uninstall the related packages and remove the ~/Android folder.

In this installation guide, the text 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-jdk

02. sudo apt-get install android-tools-adb ant

03. mkdir ~/Android

04. cd ~/Android

05. mkdir ~/Android/sdk

06. Download NDK Revision 11c from:
https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip

downloading android-ndk-r11c-linux-x86_64.zip

07. 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.zip

downloading tools_r25.2.5-linux.zip

09. Extract tools_r25.2.5-linux.zip to ~/Android/sdk

10. cd ~/Android/sdk/tools

11. ./android

12. Click Deselect All

13. Inside the Tools group
Check Android SDK Platform-tools
Check Android SDK Build-tools Rev. 25

selecting items in tools group

14. Scroll down to find Android 7.1.1 (API25)
Check SDK Platform
Check Google APIs ARM EABI v7a System Image

selecting items in Android 7.1.1 group

15. Click Install 4 packages…

16. ln -sf ~/Android/android-ndk-r11c ~/Android/ndk

17. cd /usr/bin

18. sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as arm-linux-androideabi-as

19. sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld arm-linux-androideabi-ld

20. sudo ln -sf /usr/bin/arm-linux-androideabi-as arm-linux-as

21. sudo ln -sf /usr/bin/arm-linux-androideabi-ld arm-linux-ld

22. 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

adding text in bashrc file

 

Cross Compile Android ARM

23. cd /usr/share/fpcsrc/3.0.4

24. sudo make clean crossall OS_TARGET=android CPU_TARGET=arm

25. sudo make crossinstall OS_TARGET=android CPU_TARGET=arm INSTALL_PREFIX=/usr

26. sudo ln -sf /usr/lib/fpc/3.0.4/ppcrossarm /usr/bin/ppcrossarm

27. sudo ln -sf /usr/bin/ppcrossarm /usr/bin/ppcarm

28. 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

adding text in fpc.cfg file

 

Lazarus Android Module Wizard Installation

For the steps #33, #35, #37 below, the *.lpk files are inside ~/Android/lazandroidmodulewizard.git/trunk

You need to change the text [handoko] with the current username on your computer.

 

29. cd ~/Android

30. svn co https://github.com/jmpessoa/lazandroidmodulewizard.git

31. ln -sf ~/Android/lazandroidmodulewizard.git ~/Android/lazandroidmodulewizard
If you do all the steps above correctly, the Android folder now should contains the things like this image below:

things inside Android folder

32. Start Lazarus IDE

33. Menu > Package > Open Package File (.lpk)
Select …/android_bridges/tfpandroidbride_pack.lpk

opening tfpandroidbridge_pack34. Compile, then and Use > Install > No

35. Menu > Package > Open Package File (.lpk)
Select …/android_wizard/lazandroidwizardpack.lpk

opening LazAndroidWizardPack36. Compile, then and Use > Install > No

37. Menu > Package > Open Package File (.lpk)
Select …/ide_tools/amw_ide_tools.lpk

opening amw_ide_tools

38. Compile, then and Use > Install > Yes

39. 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-amd64
Path to Ant bin: /usr/bin
Path to Android SDK: /home/[handoko]/Android/sdk
Path to Android NDK: /home/[handoko]/Android/ndk
Path to [LAMW] Java Templates:
/home/[handoko]/Android/lazandroidmodulewizard.git/trunk/java
NDK Version: 11c
NDK [prebuild] System: linux-x86_64

settings for LAMW 0.8

 

Coming soon:
“Hello, World! First LAMW Project”

4 comments on LAMW 0.8 Ubuntu 18.04 Installation Guide

  1. did not work,
    step 34 exits with error laz_and_controls_events.pas(1776,24) Error: identifier idents no member “GenEvent_OnCustomCameraSurfaceCreated”

  2. Can’t get past step 38 using all of the same versions as you. It says: lazarus.pp(161,1) Error: Error while linking

    Have tried multiple times on different installations. Any clues would be helpful, as we really need to be able to cross-compile.

    Thanks!

    1. Error while linking usually happens if you haven’t prepared the cross compiler. You will get better answer if you post your problem on Lazarus forum.

Leave a Reply

Your email address will not be published.