Lazarus
Programming => Operating Systems => Android => Topic started by: djdjdjole 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
-
Hello.
Take a look here :
http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android
It's easier than it seems, ask for any doubt.
-
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?
-
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? :-[
-
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
-
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.
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.
-
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
-
Thank's felipemdc. Although, you didn't mention, but I suppose, I have to install Java SDK, too.
Yes, it is also necessary.
If you have some proposals regarding versions (SDKs, NDK), it would be nice.
I think that the latest ones should work.
-
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
-
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
-
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
-
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
-
".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
-
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
-
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
-
I just gave up on Android. Too hard.:( Tried everything, Linux, Windows and that Linux image and nothing worked.
-
I just gave up on Android. Too hard. Tried everything, Linux, Windows and that Linux image and nothing worked.
The current state is not really friendly for new comers, maybe better in the future. I also decided to go with FPC JVM instead of LCL due to size problem, though I lost single source capability as a consequence.
-
Hi Leledumbo.
For Android I just succeeded creating an aplication with Basic4ppc, and for JVM, with Jabaco BETA.
P.S. LCL means Lazarus Component Library? FPC JVM does not work with Lazarus?
-
LCL means Lazarus Component Library?
Yes
FPC JVM does not work with Lazarus?
If you mean LCL, no. If you mean can you use Lazarus as IDE while you compile using FPC JVM, yes (in fact, this is what I do to make a good use of code browsing feature for the huge android14 unit).