Recent

Author Topic: LAMW Android Installation Tutorial  (Read 6687 times)

gary

  • New Member
  • *
  • Posts: 37
LAMW Android Installation Tutorial
« on: December 26, 2024, 03:01:32 pm »
# LAMW Android Tutorial

I am using Windows 11, 64-bit system.

## 1. Installation Section

1. I installed **laz4android3.4-FPC3.2.2.exe** on 2024-07-17. 
   Download link: [Laz4Android](https://sourceforge.net/projects/laz4android/files/?source=navba
   Reason: It has installed all the cross Android compilers: arm-android / aarch64-android / i386-android / x86_64-android / jvm-android. 
   If you want to install the cross compilers yourself, I haven’t learned about that. If anyone knows, feel free to share, or you can try using **Fpcupdeluxe** to install.

2. I installed **LAMW 0.8.6.4**. 
   Download the latest version of LAMW: 
   Link: [LAMW GitHub](https://github.com/jmpessoa/lazandroidmodulewizard/archive/master.zip
   After extracting, copy the files to **C:\laz4android3.4\components\**. Be careful not to misplace the directory; I think it won't matter too much since it's just a directory for storing components. 
   Then install the **LPK** files in this order:
   - tfpandroidbridge_pack.lpk
   - lazandroidwizardpack.lpk
   - amw_ide_tools.lpk 
   If you can’t find the files, try searching in that directory.

3. I installed **JAVA JDK 21.0.2 (64-bit)**. 
   Download link: [Oracle JDK](https://www.oracle.com/cn/java/technologies/downloads/#java21
   I chose this: [JDK Download](https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe
   Of course, you can install this JDK as well, but I haven't tried it: 
   [Adoptium](https://adoptium.net/]"]>Blockedrin/releases/)

4. I installed **Gradle 8.6**. 
   Download link: [Gradle Releases](https://github.com/gradle/gradle-distributions/releases/download/v8.11.1/gradle-8.11.1-all.zip
   I think you can download a higher version.

5. I installed **Apache Ant 1.10.14**. 
   Download link: [Apache Ant](https://ant.apache.org/bindownload.cgi
   I directly extracted it and placed it in the C drive (I believe you can place it in any directory). I think you can also download a higher version.

6. I installed **NDK r21e (Windows 64-bit version)**. 
   Download link: [NDK Unsupported Downloads](https://github.com/android/ndk/wiki/Unsupported-Downloads
   I do not recommend downloading a higher version as I am concerned about compatibility with the LAMW version.

7. I installed **SDK Commandline Tools** as **CommandlineTools-win-11076708_latest**. 
   Download link: [Android Command Line Tools](https://dl.google.com/android/repository/commandlinetools-win-11076708_latest.zip
   I created a target tree at **C:\android\sdkJ21\cmdline-tools\latest**. 
   I copied the extracted files to **C:\android\sdkJ21\cmdline-tools\latest\bin**. 
   Open a DOS command prompt and navigate to the bin directory, then execute: 
   ```bash
   sdkmanager "build-tools;34.0.0" "platforms;android-34" "platform-tools"
   ```
   It’s particularly important to note that this directly impacts your directory settings in LAMW. If this step fails, it may lead to issues with the normal operation of LAMW (this is very important).

8. Install **Android Studio**. 
   The reason I installed it is to use its emulator. You can create a new emulator in it and name it **PFAPI35** (we'll use this name later). 
   Create a bat file and save the following code to execute (xxx is your computer username) to start the emulator, so you can test without connecting a phone: 
   ```bash
   @echo off
   echo 'Start AVD'
   c:
   cd C:\Users\xxx\AppData\Local\Android\Sdk\emulator
   emulator -avd PFAPI35
   ```

## 2. Running Section

1. Project - New Project - LAMW [GUI] Android App.

2. NDK API: 22, Min. Device API: 23, Target API: 34.

3. Select Aarch64, as the emulator I installed seems to be Android 64-bit. I assume there might be errors if it’s different, which is very important.

4. Compile.

5. [LAMW] Build Android Apk and Run.

## 3. Congratulations!

You can now explore the mysterious world of Android!

---

The above document was updated on: December 26, 2024.

Please correct me if I'm wrong, thank you very much!

cdbc

  • Hero Member
  • *****
  • Posts: 2564
    • http://www.cdbc.dk
Re: LAMW Android Installation Tutorial
« Reply #1 on: December 26, 2024, 04:07:24 pm »
Hi
Cool mate, well done.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Seenkao

  • Hero Member
  • *****
  • Posts: 718
    • New ZenGL.
Re: LAMW Android Installation Tutorial
« Reply #2 on: December 27, 2024, 08:05:44 am »
Quote
Select Aarch64, as the emulator I installed seems to be Android 64-bit.
Если у вас компьютер на архитектуре x86_64, то и эмулятор надо выбирать этой же архитектуры. При этом надо помнить, что собирать проект надо именно по эту архитектуру или сразу под несколько, но чтоб данная архитектура поддерживалась в сборке.

Для поддержки большинства устройств желательно делать сборку для 4-х архитектур: x86, x86_64, arm32 и arm64 (aarch64).

--------------------------------------------
Google translate:
If you have a computer with the x86_64 architecture, then you should choose the emulator of the same architecture. At the same time, you should remember that the project should be built for this architecture or for several at once, but so that this architecture is supported in the build.

To support most devices, it is advisable to build for 4 architectures: x86, x86_64, arm32 and arm64 (aarch64).
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

gary

  • New Member
  • *
  • Posts: 37
Re: LAMW Android Installation Tutorial
« Reply #3 on: December 31, 2024, 04:42:04 am »
Please tell me how to do this, I need details of the process, thanks!

Seenkao

  • Hero Member
  • *****
  • Posts: 718
    • New ZenGL.
Re: LAMW Android Installation Tutorial
« Reply #4 on: December 31, 2024, 07:39:42 am »
gary, я не могу в данном случае помочь, я занимаюсь немного другим направлением Android. И у меня настроено всё для сборки сразу 4-х  архитектур. Спросите у разработчика LAWM как это можно сделать.

Google translate:
gary, I can't help in this case, I'm working on a slightly different area of ​​Android. And I have everything set up to build 4 architectures at once. Ask the LAWM developer how to do this.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

trom

  • New Member
  • *
  • Posts: 11
Re: LAMW Android Installation Tutorial
« Reply #5 on: November 25, 2025, 05:54:17 pm »
hello all,

First, i would like to thanks everyone who works to make lazarus the great and best RAD of the world !

I had make all the TUTO was here but i have an error :

   Verbose: Selected chip architecture: armeabi-v7a
   Verbose: Taking libraries from folder: C:\Users\Utilisateur\Dev\LAMWProjects\AppLAMWProject2\libs\armeabi-v7a
   Verbose: Found library: libcontrols.so
   Note: Dupliquer l'unité "controls" dans "controls", orphaned ppu "C:\Users\Utilisateur\Dev\LAMWProjects\AppLAMWProject2\obj\controls\controls.o"
   Note: Dupliquer l'unité "controls" dans "LCLBase 3.8", ppu="C:\lamw_manager\LAMW\LAMW4Windows\lazarus_trunk\lcl\units\arm-android\controls.ppu", source="C:\lamw_manager\LAMW\LAMW4Windows\lazarus_trunk\lcl\controls.pp"
   Projet : Exécution de la commande précédente: Succès
   before build...
   Compilation du projet, OS : android, CPU : arm, Cible : C:\Users\Utilisateur\Dev\LAMWProjects\AppLAMWProject2\libs\armeabi-v7a\libcontrols.so : Succès
   Projet : Exécution de la commande suivante: Succès
   after build...
   Building APK (Gradle)... : Succès
   Starting APK (Gradle)... : FAILURE: Build failed with an exception., Erreurs : 1
   Fatal: FAILURE: Build failed with an exception.
   * What went wrong:
   Execution failed for task ':installDebug'.
   > com.android.builder.testing.api.DeviceException: No connected devices!  >:(
   * Try:
   > Run with --stacktrace option to get the stack trace.
   > Run with --info or --debug option to get more log output.
   > Run with --scan to get full insights.
   > Get more help at https://help.gradle.org.
   Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
   You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
   For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
   BUILD FAILED in 5s
   34 actionable tasks: 1 executed, 33 up-to-date
   Exception, Erreurs : 1
   Fatal: [Exception] Failed: Cannot run APK!


and when i start an emulator, i have this ( i have just put the line diferent from above) :

   Fatal: FAILURE: Build failed with an exception.
   * What went wrong:
   Execution failed for task ':installDebug'.
   > java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any devices.  >:(
   * Try:


I have see this line :

   Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

I have try with gradle 9.0.0 and gradle 9.2.1 but i have another error :

  A problem occurred evaluating root project 'AppLAMWProject2'.
  > Could not find method jcenter() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

NOTE : my directory "<PROJECT>\bin" is empty no file with .apk extension, i have find two APK in "\build\outputs\apk\release" and "\build\outputs\apk\debug"
nut i cannot install them, my emulator and phone say : "invalid package"


Thanks for all can help me
« Last Edit: November 25, 2025, 06:00:14 pm by trom »

dseligo

  • Hero Member
  • *****
  • Posts: 1650
Re: LAMW Android Installation Tutorial
« Reply #6 on: November 25, 2025, 11:10:42 pm »
   > com.android.builder.testing.api.DeviceException: No connected devices!  >:(

IMHO, you have to sort this out first.

You can use Google's adb.exe tool to check if the phone is connected.

Find it's location, open command prompt and use it like this (change path to wherever is your adb located):
Code: Text  [Select][+][-]
  1. C:\LazarusLAMW_2024-02-06\sdk\platform-tools\adb devices

You are probably getting this:
Code: Text  [Select][+][-]
  1. C:\>C:\LazarusLAMW_2024-02-06\sdk\platform-tools\adb devices
  2. List of devices attached
  3.  
  4.  
  5. C:\>

Check your USB cable and if you turned on USB debugging on the phone.
After connecting, you may also need to allow access from computer to the phone (you do this on the phone).

Sometimes I got 'error: device unauthorized' - then I either put phone mode to 'charging only' and phone then asks me if I allow access or I turn USB debugging off and then again on.

Anyway, you need to have this before you will succeed on installing apk on the phone:
Code: Text  [Select][+][-]
  1. C:\>C:\LazarusLAMW_2024-02-06\sdk\platform-tools\adb devices
  2. List of devices attached
  3. RFCW381CNWW     device
  4.  
  5.  
  6. C:\>
« Last Edit: November 25, 2025, 11:15:33 pm by dseligo »

trom

  • New Member
  • *
  • Posts: 11
Re: LAMW Android Installation Tutorial
« Reply #7 on: November 26, 2025, 07:54:00 pm »
dseligo thanks for your help,

I have  connected my Phone and ADB find himn i have no error in the error window of lazarus But:

My phone said WRONG PACKAGE (incompatible), XIAOMI REDMI 11

And then i GO to the directory "<PROJECT>\bin", i haven't file .apk ?? and when i go to  "\build\outputs\apk\release" and "\build\outputs\apk\debug" and take the two APK this package isn't compatible with any phone and  Tabs ?



dseligo

  • Hero Member
  • *****
  • Posts: 1650
Re: LAMW Android Installation Tutorial
« Reply #8 on: November 26, 2025, 11:40:06 pm »
My phone said WRONG PACKAGE (incompatible), XIAOMI REDMI 11

Try this: go to menu Project, Project Options and '[LAMW] Android Project Options', click tab 'Build' and there select 'Aarch64' chipset.
Try to build and install again.

trom

  • New Member
  • *
  • Posts: 11
Re: LAMW Android Installation Tutorial
« Reply #9 on: November 30, 2025, 08:52:15 pm »
THANKS dseligo  :),

My first Goal was to use the EMULATOR come with the ANDROID SDK package, after your post i have found that this emulator is an  X86_64, i have put this configuration in the project option, and all is allright now !!!

My Second goal was to use on my tablet TECLAST P20HD(AARCH64),  i activate the DEV mode and authorizing the usb debug, all is allright !!!

My third goal is to instal on my phone, my phone is a xiaomi REDMI 9T (AARCH64), after put my phone un DEV mode and authorizing the usb debug, my phone wouldn't install the package, i have search and found an option on it, you must have a XIAOMI ACCOUNT and authorizing "INSTALL FROM USB" from the "DEV" menu, now all is allright !!.

I will try soon on ZEBRA MC9300.

dseligo

  • Hero Member
  • *****
  • Posts: 1650
Re: LAMW Android Installation Tutorial
« Reply #10 on: November 30, 2025, 09:42:03 pm »
 :)

I'm glad it worked

 

TinyPortal © 2005-2018