0% found this document useful (0 votes)
845 views18 pages

Lazarus and Android

This document provides step-by-step instructions for setting up Lazarus to build Android apps on Windows. It describes downloading and installing the Java JDK, LazToApk, Lazarus packages, Android SDK and system images, and configuring an Android virtual device. The instructions conclude by building a sample "project1" app and running it on the virtual device.

Uploaded by

k1attila1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
845 views18 pages

Lazarus and Android

This document provides step-by-step instructions for setting up Lazarus to build Android apps on Windows. It describes downloading and installing the Java JDK, LazToApk, Lazarus packages, Android SDK and system images, and configuring an Android virtual device. The instructions conclude by building a sample "project1" app and running it on the virtual device.

Uploaded by

k1attila1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

20.

Oktober 2014
Important Note:
A)Please remove previous versions before installing a new version.
B)Installation path containing SPACE char's do still not work.

What's new?
[Link] 2014 (V0.9.0.27)
- updated setup to the latest laz4android package. (laz4android1.3-46592
FPC2.7.1.7z)
- added version 5.0 lollipop to laztoapk selection box.
[Link] 2014 (V0.9.0.26)
Note: If you have a running/working installation you do not need to upgrade to
V0.9.0.26.
- some minor fixes.
- display more info to the user.
- improved and cleaned up installation document.
[Link] 2014 (V0.9.0.25)
- updated installer to use/download the sdk android-sdk_r22.6.2.
- updated installer to use/download the ndk android-ndk-r9d-windows-x86.
- added Info-Form which will be displayed while the search for ndk/sdk stuff is
running.

Content
Step 01: Download&Install JDK.....................................................................................................2
Step 02: Download&Install LazToApk...........................................................................................2
Step 03: Start&Configure LazToApk for the first time...................................................................4
Step 04: Start Lazarus and install package CustomDrawn..........................................................6
Step 05: Start SDK-Manager and install API's................................................................................8
Step 06: Restart LazToApk and start AVD-Manager.....................................................................11
Step 07: Build your first android app.............................................................................................13
Step 08: Run the app......................................................................................................................16

Lazarus and Android


To create Android Apps with Lazarus (on windows), you need to download and
install the following packages. (Warning, this will take at least 5GByte of disk
space).
The whole installation&compile process can take up to one hour depending on
your hardware and internet connection.
Please follow exactly this instructions, otherwise the chance is very that your
final app will not work!
I tested on windows xp sp3. (on windows 7 you might run this setup as
administrator)

Step 01: Download&Install JDK


JDK 1.7u45 Java JDK 7 ([Link])
It will be installed in to <C:\Program Files\Java\>.

Step 02: Download&Install LazToApk


LazToApk Download the setup from here. ([Link])
Run the setup.
The setup will automatically:
1.) download [Link] to \laztoapk\downloads and then unpack it to
\laztoapk\downloads\ndk
2.) download [Link] to \laztoapk\downloads and then unpack it to
\laztoapk\downloads\sdk
3.) download laz4android-43585-New.7z to \laztoapk\downloads and then
unpack to \laztoapk\downloads\laz4android
4.) run \laztoapk\downloads\laz4android\[Link] to recompile Lazarus.

After you press button <Finish>, laz4android get's compiled. This may take a

while and look's something like this.

Step 03: Start&Configure LazToApk for the first time


Now the application LazToApk will be started.
LazToApk will verify if the folder's for JDK,SDK,NDK and the tool [Link]
are available. If not, then following path setup dialogs will show up and you
must select the correct path manually.
On the first start of LazToApk, you will be asked to select the path to JDK.
Setup path to JDK:
Set the <Initial Folder> and then press button <Find>. Double-click on the
marked entry.

The following path's should be set automatically by LazToApk. So in most cases


it's not needed to setup them manually.
Setup NDK:
Press button <Find>. Double-click on the marked entry.

Setup SDK:
The path is usually setup automatically. On the first time you will see the
following message. This is fine for now. Just press <OK>.

Finally LazToApk should show up and look like this:

Step 04: Start Lazarus and install package CustomDrawn


Press button <Start IDE>.

Now we need to install package CustomDrawn. Select <Package>


<Install/Uninstall Packages>.

Double-Click on CustomDrawn Package and then button <Save and rebuild


IDE>.

After the IDE has been rebuilt, you have to exit Lazarus.

Step 05: Start SDK-Manager and install API's


Now LazToApk will look like this. It's time to start the <SDK Manager>.

Select the following packages. ( you can try some other's but I did not test
with other version's!!!!)

This will take a while. The installation is finished, when the following Dialog
shows up.

Now close the SDK Manager and start it again.


De-Select items <Android L> and <Android 4.4W> and select <ARM EABI v7a
System Image>.

After another few minutes, you will see again this message:

Installation of SDK tools is now finished. Please close the SDK Manager.

Step 06: Restart LazToApk and start AVD-Manager


Close LazToApk and start LazToApk again.
Select <NDK-Platform> 4.0(API14) and press button <Start AVD Manager>

Setup a new virtual android device.


Press Button <Create>.

The choose the following setup:

Press button <Start> to start the virtual android device.


The virtual device will look like this: The virtual android device is ready.

Step 07: Build your first android app


Press button Select.

Select the folder projects and press button Create new folder.

Create a new folder project1, select the new folder and press button <OK>.

Press button Build&Deploy.

In the following dialogue, define a password for your app and press button
<OK>.

The following info message will appear.

You have to enter the same password as before twice in the command windows

and do some more input as requested.


If everything works as expected, then it should look like this:

Well done, the app is now installed.


If you see something like this, then the installation of the apk-file failed.

In this case I close the virtual android device and start it then again. The you
can try to install the apk-file manually.

Step 08: Run the app


Let's run the app. Click onto the following icon:

Then click on project1.

And enjoy your first android application.

You might also like