LAMW

From Lazarus wiki
Jump to navigationJump to search

Note

This is quick copy of the tutorial HOW_TO_INSTALL_by_Dieselnutjob.pdf (for Windows) Images and other details should come ASAP.

Installation for Linux will be added later, for now you can checkout https://github.com/jmpessoa/lazandroidmodulewizard and read linux/new_how_to_install_by_renabor.txt.


What is LAMW

This is a set of Lazarus wizards you will launch from menus Build and Tools.

It helps to set parameters, organize libraries and to run the tools required to make APK files, used to install applications on Android.


How to install on Windows

This is working on Windows 8 and 10 Home Edition 64 bits.

1) Downloads

Create folders C:\lamw and C:\lamw\projects

Download these files in the folder C:\lamw :

SDK 24.4.1

NDK r10e

Ant 1.9.6

jdk-8u65-windows-i586.exe Jdk 8u65

Laz4Android 1.5-50093-FPC3.1.1

lamw download.png

Checkout with a svn client (Tortoise SVN )

https://github.com/jmpessoa/lazandroidmodulewizard to C:\lamw\lazandroidmodulewizard

lamw svn checkout 1.png

lamw svn checkout 2.png

Important Notes :

Versions specified here are currently working, although some of them are old and even hidden by their creator/publisher.

But the latest stable versions are not always compatible with the tool (NDK at least).

If a more recent stable version is found working well, please update the Wiki.

You may have already the kits installed somewhere else on your computer. It might lead to problems if you try to re-use them. The safer is to make new downloads in c:\lamw. Be aware to use the corresponding versions and do not use shortcuts previously installed with other versions.

2) Installations

Extract android-sdk_r24.4.1-windows.zip in c:\lamw\android-sdk_r24.4.1-windows

Extract android-ndk-r10e-windows-x86.zip in c:\lamw\android-ndk-r10e-windows-x86

Extract apache-ant-1.9.6-bin.zip in c:\lamw\apache-ant-1.9.6

Extract laz4android1.5-50093-FPC3.1.1.7z to C:\lamw\Laz4Android

Execute jdk-8u65-windows-i586.exe . It will install the JDK to C:\Program Files (x86)\Java\jdk1.8.0_65\

Notes :

Depending on the tool you use to extract zip or 7z, be sure to have not the first folder twice.

Something like c:\lamw\android-ndk-r10e-windows-x86\android-ndk-r10e-windows-x86 will lead to errors below...

3) Update Java development kits

run C:\lamw\android-sdk-windows\SDK Manager.exe

  1. deselect Android 6.0 (API 23)
  2. select Android SDK Platform-tools
  3. select Android SDK Build-tools
  4. select Android Support Library
  5. select Google USB Driver
  6. click Install 4 packages
  7. Accept license and click Install
  8. wait for downloads to finish
  9. Exit SDK Manager

lamw sdk manager 1.png


Run C:\lamw\android-sdk-windows\SDK Manager.exe again

  1. deselect Android 6.0 (API 23)
  2. expand Android 4.2.2 (API 17)
  3. select SDK Platfrom
  4. select ARM EABI v7a System Image
  5. click Install 2 packages
  6. Accept license and click Install
  7. wait for downloads to finish
  8. Exit SDK manager

lamw sdk manager 2.png

4) Build and prepare Laz4Android

From Windows, run cmd, then :

cd \lamw\Laz4Android build.bat

lamw cmd laz4android 1.png

lamw cmd laz4android 2.png

When finished, exit cmd mode

Create a shortcut on your desktop for C:\lamw\laz4android\startlazarus.exe

Execute it

Start IDE

Package -> Open package file (.lpk)

select C:\lamw\lazandroidmodulewizard\trunk\tfpandroidbridge_pack.lpk

Compile

Use>> Install

Do you want to rebuid Lazarus now? Yes

Laz4Android will restart

Package -> Open package file (.lpk)

select C:\lamw\lazandroidmodulewizard\trunk\lazandroidwizardpack.lpk

Compile

Use>> Install

Do you want to rebuid Lazarus now? Yes

Laz4Android will restart

Package -> Open package file (.lpk)

select C:\lamw\lazandroidmodulewizard\trunk\ide_tools\amw_ide_tools.lpk

Compile

Use>> Install

Do you want to rebuid Lazarus now? Yes

Laz4Android will restart

5) Path settings

In Laz4Android :

Tools -> [LAMW] Android Module Wizard -> Path settings

Path to Java JDK: C:\Program Files (x86)\Java\jdk1.8.0_65
Path to Ant bin: C:\lamw\apache-ant-1.9.6\bin
Path to Android SDK: c:\lamw\android-sdk_r24.4.1-windows
Path to Android NDK: C:\lamw\android-ndk-r10e
NDK version: 10e
Path to Simonsay's templates: C:\lamw\lazandroidmodulewizard\trunk\java

lamw configure project.png

OK.

File -> Restart

6) Create your first project

In Laz4Android :

Project -> Close project [if necessary]

Project Wizard -> New project

JNI Android Module [Lamw GUI] OK
Path to Workspace [Projects Folder]: C:\lamw\projects
New Project Name: LamwGUIProject1
Default Package Name: org.lamw
Include "android-support-v4.jar": no
NDKPlatfom: 17
MinSdkAPI: 17
TargetSdkApi: 17
Instruction: ARMv7a
ARM Fpu: Soft
Android Theme: DeviceDefault

Save unit1.pas Save

Hover over any unit in uses, IDE will error

File -> Restart

Hover over any unit, IDE does not error

Drag from Android Bridge, jButton onto form

Events OnClick, double click and add :

procedure TAndroidModule1.jButton1Click(Sender: TObject);
begin
ShowMessage('Hello World');
end;

File -> Save All

Run -> Build

Target: C:\lamw\projects\LamwGUIProject1\libs\armeabi\libcontrol.so: Success

Run -> [Lamw] Build APK and run

Building APK...: Success

Copy C:\lamw\projects\LamwGUIProject1\bin\LamwGUIProject1-debug.apk to the Android device

Install using phone file manager