Recent

Author Topic: Lazarus on Android  (Read 35963 times)

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Lazarus on Android
« on: October 01, 2012, 06:52:30 pm »
I have some moderate experience in using Lazarus in Windows and Linux. Now I am interested in programing Android applications using Lazarus. Can anyone explain me or point me to articles/sites where I can learn more about the matter.
Can I use Lazarus installed on Linux or Windows machine for compiling Android applications ? What should I do to enable compiling for Android using Lazarus IDE ? Do I need to build Android like I usually did with Linux ?

Regards

eMarc

  • New Member
  • *
  • Posts: 35
Re: Lazarus on Android
« Reply #1 on: October 01, 2012, 08:20:47 pm »
Hello.

Take a look here :

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android

It's easier than it seems, ask for any doubt.

tatamata

  • Hero Member
  • *****
  • Posts: 787
    • ZMSQL - SQL enhanced in-memory database
Re: Lazarus on Android
« Reply #2 on: October 01, 2012, 10:42:41 pm »
Maybe sounds crazy, but, last half of year I'm almost exclusively on an Android tablet (Transformer Prime with docking keyboard), so I'm wondering whether and when am I going to be able to use Lazarus on android?
I mean, not to compile for Android, but to program on android?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lazarus on Android
« Reply #3 on: October 02, 2012, 08:19:27 am »
Quote
I mean, not to compile for Android, but to program on android?
:o
It's theoritically possible though, using the same approach as current (so the IDE resides in a .so), but who wants to complete it? :-[

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #4 on: October 14, 2012, 02:18:35 pm »
I have red tutorial http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android
and I am in doubt if it states two possible paths - one using VirutalBox and the other by building/installing precompiled FPC. Or should I do both steps, which I doubt, because VritualBox already contains FPC ?
Because I successfully installed everything needed to compile linux ARM applications, (and made few), I prefer Linux solution. However, in tutorial, I don't see steps for installing Android SDK and NDK in Linux (and maybe something else -what if so ?) like it was for Windows.
I don't know why, or I missunderstand something.

Regards

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Lazarus on Android
« Reply #5 on: October 16, 2012, 08:51:05 am »
I have red tutorial http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android
and I am in doubt if it states two possible paths - one using VirutalBox and the other by building/installing precompiled FPC. Or should I do both steps, which I doubt, because VritualBox already contains FPC ?

The VirtualBox is very old, so I would go with the more manual path if I were you.

Quote
Because I successfully installed everything needed to compile linux ARM applications, (and made few), I prefer Linux solution. However, in tutorial, I don't see steps for installing Android SDK and NDK in Linux (and maybe something else -what if so ?) like it was for Windows.

It is necessary to install the SDK and NDK in Linux too. In the VirtualBox image they are already installed.

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #6 on: October 16, 2012, 09:22:38 am »
Thank's felipemdc. Although, you didn't mention, but I suppose, I have to install Java SDK, too. If you have some proposals regarding versions (SDKs, NDK), it would be nice.

Regards

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Lazarus on Android
« Reply #7 on: October 16, 2012, 09:37:08 am »
Thank's felipemdc. Although, you didn't mention, but I suppose, I have to install Java SDK, too.

Yes, it is also necessary.

Quote
If you have some proposals regarding versions (SDKs, NDK), it would be nice.

I think that the latest ones should work.

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #8 on: October 16, 2012, 11:35:02 am »
Although, I consider tutorials as very usefull articles, I suppose it would be awesome if someone would make an explanation of process of building Android application with Lazarus. For example, how some function's call or widgets drawing or ... relates to what part of Android SDK or NDK and where is JDK in path of compiling and executing application.
I intend to try the steps in tutorial, whether Windows of Linux based, but consider that it would be good to know what and why in fact I am doing.
Also, is  Lazarus 1.0 OK, because I somehow found the combination of FPC and Lazarus that successfully bild my ARM board's applications (with 1.1, I didn't have success - http://forum.lazarus.freepascal.org/index.php/topic,17950.0.html).

Regards

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #9 on: October 17, 2012, 03:20:22 pm »
Here is the problem I faced, after generating key and try building script (this is excerpt from output):

.
.
.
Note: src\com\pascal\lcltest\LCLActivity.java uses uncecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

trouble processing:
bad class file magic <cafebabe> of version <0033.0000>
...while parsing com/pascal/lcltest/LCLActivity$1.class
...while processing com/pascal/lcltest/LCLActivity$1.class

<THERE FOLLOW MORE WARNINGS OF SIMILAR CONTENT>
.
.
.
14 warnings
no classfiles specified

THIS TOOL IS DEPRECATED. See --help for more information.

java.io.FileNotFoundException: C:\lazarus\examples\androidlcl\android\bin\classes.dex does not exist
Could Not find C:\lazarus\examples\androidlcl\android\bin\androidlcltest-unaligned.apk
Unable to open 'bin\androidlcltest-unaligned.apk' as zip archive

Result is that "androidlcl_ap_" file was generated, and "androidlcltest_unsigned.apk has size of 0.
Platfrom that I downloaded is android-16. Wherever was "Program Files", I used "Progra~1" in .bat files.

I hope someone can help.

Regards

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #10 on: October 17, 2012, 05:14:25 pm »
At the end of my working time I tried with earlier JDK version. Before that I delete debug key file and generate new one. Then started another script and it passes well (..._unsigned.apk generated), until the point where it says:
keystore load: Keystore was tampered with, or password was incorrect.
Didn't have time to inspect the matter, however it is strange, because key was generated a minute before !!! (maybe key should not be deleted simply by removing the file).

Regards
 

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #11 on: October 18, 2012, 07:09:41 pm »
I didn't noticed in tutorial, but comprehend too late, that one must also change password at the bottom of one of two .bat files (the one for building purposes). That must be according to passwords entered during key generation.
Then I successfully compiled example and got signed .apk file.
However, when transfered to a phone, it states that application terminated unexpectedly. Phone has Android 2.3 and I installed API version 8 (2.2).
File size is 1.3 Mb, and I don't know if it is OK, since I think I saw somewhere that someone states the file size is 5Mb.  Also it is a little bit strange to me the name of lib... file (after compiling in Lazarus) having  ".so.so" at the end.
I hope someone can help me.

Regards

Fortuna1

  • Full Member
  • ***
  • Posts: 164
Re: Lazarus on Android
« Reply #12 on: October 19, 2012, 06:24:43 am »
".so.so"
just rename  to .so


or 
change in lazarus
Compiler Options
Paths

change this
android/libs/armeabi/liblclapp.so  to android/libs/armeabi/liblclapp

Next step is

cd C:\lazarus\examples\androidlcl\android

generate_debug_key  //change path

build_debug_apk      //change path and put   (user an password generate with  generate_debug_key )


and then get  apk

« Last Edit: October 19, 2012, 06:34:54 am by Fortuna1 »

djdjdjole

  • Full Member
  • ***
  • Posts: 101
Re: Lazarus on Android
« Reply #13 on: October 19, 2012, 10:18:18 am »
Yes, I' ve already note it (so.so stuff) and changed it first thing in the morning. Interesting is that .apk almost doubled at size. Works on phone.
I should try something other than this example.

Does someone know if Lazarus network components and serial communication (5do - synaser) work on android platform ? Serial communication is interesting to me for some ARM board (not the phone) that I have (4 COM ports).
What about bluetooth ?

Regards

irw10062

  • New Member
  • *
  • Posts: 31
Re: Lazarus on Android
« Reply #14 on: October 20, 2012, 04:44:58 am »


The VirtualBox is very old, so I would go with the more manual path if I were you.


Sir,
maybe you could make new virtualbox with latest update support arm android & i386 linux
and maybe with support svn so we only can update if needed
i build my linux program using virtualbox too from windows

 

TinyPortal © 2005-2018