Lazarus

Announcements => Lazarus => Topic started by: felipemdc on August 09, 2011, 11:18:40 am

Title: First steps of LCL-Android are ready
Post by: felipemdc on August 09, 2011, 11:18:40 am
I am happy to announce that the basic infra-structure for a LCL-Android widgetset is done, and this includes:

* An example LCL-Android application: http://wiki.lazarus.freepascal.org/Android_Interface#Compiling_the_example_LCL-Android_Application
* An application which automatically generates bindings for the Android SDK
* Basic widgetset implementation for TForm and TButton

To create new LCL-Android applications one should first make sure that he can compile the example application and install and run it. Then copy it, modify all the ANT build files to the new project, change the Java files package name, add an icon, application name, etc, and it is should be ready. Of course, not much is implemented in the LCL-Android at this moment, so one will need to send patch for the LCL-Android to get things running =)

The LCL-Android uses native widgets at the moment, but complex widgets without a compatible Android equivalent will be implemented using an OpenGL surface and a control from the Custom Drawn Package.

Basically I just though it would be good to anounce that the LCL-Android achieved a milestone and that at this point it is rather easy for people to contribute to this project because the basic infrastructure is ready. Basically this means that contributors are welcome ;)
Title: Re: First steps of LCL-Android are ready
Post by: BigChimp on August 09, 2011, 11:34:40 am
Good work, Felipe, and a very subtle invitation  :)
Title: Re: First steps of LCL-Android are ready
Post by: herux on August 09, 2011, 04:21:32 pm
Thank for your great work felipe.
Title: Re: First steps of LCL-Android are ready
Post by: mschnell on August 09, 2011, 04:53:52 pm
+1 +1 +1  :)
-Michael
Title: Re: First steps of LCL-Android are ready
Post by: JanRoza on August 09, 2011, 08:55:39 pm
Great show Felipe.  ;D
If the Android connection for Lazarus grows up, it opens a huge market area for Lazarus and free Pascal as Android rules in the phone world now.
Title: Re: First steps of LCL-Android are ready
Post by: fredycc on August 09, 2011, 09:16:21 pm
 :o Amazing Felipe,

Very good news, looks very promising  :)


Regards,
Title: Re: First steps of LCL-Android are ready
Post by: mac.1 on August 09, 2011, 09:23:02 pm
Great.

I've been thinking about whether buy an Samsung Galaxy S2 or not.
But creating own App's would be really cool :D
Title: Re: First steps of LCL-Android are ready
Post by: gropelo on August 09, 2011, 11:47:41 pm
Very good job Felipe!  :D
Title: Re: First steps of LCL-Android are ready
Post by: nicke85 on August 10, 2011, 12:29:52 am
This is amazing.Excellent work Felipe :)
Title: Re: First steps of LCL-Android are ready
Post by: kukingdom on August 10, 2011, 11:23:49 am
Great!    ;D
However,Java still seems to rule in the phone world,
so why not creat a phone system used Pascal??!!! 
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 10, 2011, 11:35:36 am
so why not creat a phone system used Pascal??!!!

Just give me 1 billion dollars and I might ;)

Just joking, but seriously, only a huge company can do that.
Title: Re: First steps of LCL-Android are ready
Post by: Laksen on August 10, 2011, 06:21:51 pm
so why not creat a phone system used Pascal??!!!

Just give me 1 billion dollars and I might ;)

Just joking, but seriously, only a huge company can do that.
Just give me some help and I might :)
Title: Re: First steps of LCL-Android are ready
Post by: JD on August 11, 2011, 12:22:42 am
C'est formidable Felipe!
Title: Re: First steps of LCL-Android are ready
Post by: BlueIcaro on August 11, 2011, 12:31:53 am
Great Work !!!
so why not creat a phone system used Pascal??!!!

Just give me 1 billion dollars and I might ;)

Just joking, but seriously, only a huge company can do that.
Felipe, if you have the 1 billon dollars, call me, I will work for you, only for 250.000 € per year  ;)

/BlueIcaro
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 11, 2011, 11:25:16 am
Now TButton, TStaticText, TEdit, TCheckBox and TComboBox have minimal implementations. Button OnClick already works.
Title: Re: First steps of LCL-Android are ready
Post by: mac.1 on August 11, 2011, 09:34:40 pm
Nobody would buy a phone with a pascal OS on it,
except we Call it "iPascal" , and put some vegetables at the back. Then it would rule the world  >:D
Title: Re: First steps of LCL-Android are ready
Post by: mdalacu on August 12, 2011, 07:05:08 am
Nobody would buy a phone with a pascal OS on it,
except we Call it "iPascal" , and put some vegetables at the back. Then it would rule the world  >:D

It's sad but true!  :(
Anyway i hope that Android branch will catch momentum here because i love them both (Android + Lazaus)  :-[
Title: Re: First steps of LCL-Android are ready
Post by: laguna on August 13, 2011, 04:37:02 pm
Hello Felipe,
11.4 on ubuntu I installed the following packages:
fpc-2.4.4-1.i386.deb.tar
lazarus-0.9.31.31952-20110812.i386.deb.tar

Lazarus is working properly.
Can you tell me step by step, what should I install to be able to create applications for Android?
I ask this because in following the guidance which is mentioned above did not succeed, and I did not understand where I went wrong.
 
Thanks for everything.
Title: Re: First steps of LCL-Android are ready
Post by: RandyBeck on August 15, 2011, 11:40:08 pm
Congrats!

Shouldn't this news go out on the twitter feed?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 16, 2011, 08:02:40 am
Hello Felipe,
11.4 on ubuntu I installed the following packages:
fpc-2.4.4-1.i386.deb.tar
lazarus-0.9.31.31952-20110812.i386.deb.tar

Lazarus is working properly.
Can you tell me step by step, what should I install to be able to create applications for Android?
I ask this because in following the guidance which is mentioned above did not succeed, and I did not understand where I went wrong.

Hello,

1> First of all I recommend using Lazarus from SVN instead of Lazarus from a snapshot. http://wiki.lazarus.freepascal.org/Getting_Lazarus#Getting_Lazarus_SVN_development_version

You can build Lazarus with the command lines:

cd lazarus
make bigide

2> Install the crosscompiler as described here: http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre-compiled_compiler

3> Download the lazarus-ccr with this command:

svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr lazarus-ccr

Or if you have limited disk space just what matters:

svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/examples/androidlcl androidlcl

4> Now compile the example project in lazarus-ccr/examples/androidlcl

5> Download and install the Android SDK

6> Open all files in lazarus-ccr/examples/androidlcl/android and see where you need to update the SDK location

7> Build the Android package using this command line:

cd lazarus-ccr/examples/androidlcl/android
ant debug

If you don't have ant you need to install it.
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 16, 2011, 10:44:20 am
I have meet  an error :  "androidlcltest.lpr(1,1) Fatal: Can't find unit Interfaces used by androidlcltest  "   Do you know the reason?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 16, 2011, 10:48:18 am
I have meet  an error :  "androidlcltest.lpr(1,1) Fatal: Can't find unit Interfaces used by androidlcltest  "   Do you know the reason?

Do you have the arm-linux cross-compiler installed?

Which Lazarus version are you using? It must be the latest SVN
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 17, 2011, 05:07:51 am
I hava installed cross compiler  . I found the Unit path is not correct! After I add the correct Unit path the problem is not solved.Maybe I dont use lastest SVN .  Lazarus 0.9.30  fpc:2.4.2
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 17, 2011, 08:05:35 am
I hava installed cross compiler  . I found the Unit path is not correct! After I add the correct Unit path the problem is not solved.Maybe I dont use lastest SVN .  Lazarus 0.9.30  fpc:2.4.2

The latest lazarus svn is version 0.9.31 so for sure you are not using svn if you have 0.9.30

LCL-Android is available only in Lazarus SVN at the moment.
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 17, 2011, 12:33:12 pm
I try to use the pre-compiled compiler .MY system is Ubuntu .I dont find the suitable "cross-arm-binutils" .Is cross-arm-binutils-2.20.51.0.4-2mnb2.i586.rpm OK for ubuntu ???
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 17, 2011, 12:44:47 pm
I try to use the pre-compiled compiler .MY system is Ubuntu .I dont find the suitable "cross-arm-binutils" .Is cross-arm-binutils-2.20.51.0.4-2mnb2.i586.rpm OK for ubuntu ???

You can try that, but I don't think it is a good idea. The best would be if you find the real cross-arm-binutils from Ubuntu. You could try asking where they are in a forum to discuss Ubuntu or maybe someone here that uses Ubuntu will know.
Title: Re: First steps of LCL-Android are ready
Post by: Leledumbo on August 17, 2011, 02:03:42 pm
Quote
You can try that, but I don't think it is a good idea. The best would be if you find the real cross-arm-binutils from Ubuntu. You could try asking where they are in a forum to discuss Ubuntu or maybe someone here that uses Ubuntu will know.
I'd rather built from source instead
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 19, 2011, 05:35:20 pm
Today I added quite a number of features:

* TComboBox now works, which involved adding support for interfaces in the bindings generator
* TextEdit.getText is now implemented, which involved adding support for reading text from Java
* I implemented a logging mechanism, now the Pascal side can write log messages to the Android console

One can take a look at the image here to see how it looks like now:

http://wiki.lazarus.freepascal.org/Android_Interface#Compiling_the_example_LCL-Android_Application
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 25, 2011, 04:41:32 am
Hi felipemdc! The apk I get is 1.9M. It doesnt work when I install . Lazarus 0.9.31 fpc 2.4.2 .Do you know Why? Thnak you !
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 09:24:56 am
Are you sure that you compiled androidlcl in the build mode "Android" ?

Try the following command:

file androidlcl/android/libs/armeabi/libandroidlcl.so

And post here the result
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 25, 2011, 10:50:40 am
Hi felipemdc ,the "libandroidlcltest.so" doesnt exist but libandroidlcltest.so  the result is :/home/hotcyy/lazarus-ccr/examples/androidlcl/android/libs/armeabi/libandroidlcltest.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped.
 

Do you have a clue? Thanks
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 11:30:46 am
Well, it is obviously compiled for the wrong architecture, maybe even wrong widgetset.

Which build mode are you using? Are you using Lazarus from subversion?
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 25, 2011, 12:11:56 pm
Well, it is obviously compiled for the wrong architecture, maybe even wrong widgetset.
   Sometimes I also think I compiler for i386-linux not arm-linux . I haved worked out " the turbochessclock4android  " (another example ),so I setup the cross compiler and lazarus as the same but it doesnt work this time ! How to  know the APK for i386-linux or arm-linux?
  widgetset  I choose gtk2 :Tools/Configure Build Lazarus  and Projec Options/Comlier Options/Build Modes/Set macro values..

Which build mode are you using? Are you using Lazarus from subversion?
   Projec Options/Comlier Options/Build Modes : The Active checkbox  of android is True .Is it Right? 
  Yes I use the lastest subversion lazarus 0.9.31 .What is More:A few days ago ,I use lazarus 0.9.30 ,finally I got the APK(It is 1.9M and It can not work too)。
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 12:16:56 pm
   Sometimes I also think I compiler for i386-linux not arm-linux . I haved worked out " the turbochessclock4android  " (another example ),so I setup the cross compiler and lazarus as the same but it doesnt work this time ! How to  know the APK for i386-linux or arm-linux?

Use the file command as previously. The result of the file command that you posted clearly shows that the binary is for x86

You can also try this:

ldd libsomething.so

If it uses any gtk lib then it isn't even compiled for the android widgetset.

Quote
   Projec Options/Comlier Options/Build Modes : The Active checkbox  of android is True .Is it Right? 
  Yes I use the lastest subversion lazarus 0.9.31 .What is More:A few days ago ,I use lazarus 0.9.30 ,finally I got the APK(It is 1.9M and It can not work too)。

And what is configured for widgetset? And for architecture? And for operating system? Maybe post some screenshots of your project options dialog?
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 25, 2011, 12:31:35 pm
felipemdc
The screenshots of my project options : 1 Build Modes   2 Code Generation
Title: Re: First steps of LCL-Android are ready
Post by: IndianaJones on August 25, 2011, 12:34:14 pm
Hi Felipe,
I have completed compiling androidlcl, but encountered with this error when I have done ant debug.

Buildfile: /home/indianajones/android/androidlcl/android/build.xml

BUILD FAILED
/home/indianajones/android/androidlcl/android/build.xml:46: taskdef class com.android.ant.SetupTask cannot be found
 using the classloader AntClassLoader[]

Total time: 2 seconds

Any idea?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 12:52:19 pm
BUILD FAILED
/home/indianajones/android/androidlcl/android/build.xml:46: taskdef class com.android.ant.SetupTask cannot be found
 using the classloader AntClassLoader[]

This is not really an error while building the project, but rather a missing part of the ant installation. Are you using Linux or Mac OS X?

I installed a huge amount of java packages in my distro until it finally worked, so I no longer remember what is really required. If you are using linux, search for any packages with ant, or with setuptask and try to install them. I am sure that if you install enough packages it will eventually work.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 12:56:03 pm
felipemdc
The screenshots of my project options : 1 Build Modes   2 Code Generation

Well, they are clearly wrong. In the first screenshot change the widgetset to Android. Not just the build mode, but the widgetset too.

In the second screenshot set the target CPU to ARM

Set the operating system to Linux.

Strange that all those configurations are wrong.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 12:57:39 pm
This is not really an error while building the project, but rather a missing part of the ant installation. Are you using Linux or Mac OS X?

I installed a huge amount of java packages in my distro until it finally worked, so I no longer remember what is really required. If you are using linux, search for any packages with ant, or with setuptask and try to install them. I am sure that if you install enough packages it will eventually work.

Another idea I just had: Maybe you don't have the Android SDK installed? You need to install it and set the path to it in the files under androidlcl/android/* (check all files, one of them has the sdk path)
Title: Re: First steps of LCL-Android are ready
Post by: IndianaJones on August 25, 2011, 02:23:49 pm

It seems that just ant package and sun-java6-jdk are fine for compilation instead I use Debian based distribution.
Here is the solution, I have found in this web page.
http://code.google.com/p/android/issues/detail?id=14773 (http://code.google.com/p/android/issues/detail?id=14773)
when I have done $SDK/tools/android update project -p /path/to/project everything is fine now.
But another question is, in the bin directory there are two apk files which are AndroidLCLTest-debug.apk and AndroidLCLTest-debug-unaligned.apk
which one I am going to use?
PS. ant version is 1.8.2

Thanks.


Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 02:31:24 pm
Use only AndroidLCLTest-debug.apk
Title: Re: First steps of LCL-Android are ready
Post by: IndianaJones on August 25, 2011, 02:42:11 pm

Felipe, I use and install both of them, but I see just a blank black window and it exists eventually.  %)
Here are some details.
Android version 2.3.4
Google Nexus one.
Thanks.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 03:32:12 pm
What does your logcat say?

./adb logcat
Title: Re: First steps of LCL-Android are ready
Post by: IndianaJones on August 25, 2011, 05:20:15 pm

Here is the log when I execute the app.

I/power   (   92): *** set_screen_state 1
D/SurfaceFlinger(   92): Screen about to return, flinger = 0x8e078
D/AK8973  (   73): Compass Start
D/VoldCmdListener(   63): volume shared /mnt/sdcard ums
I/ActivityManager(   92): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher } from pid 92
V/RenderScript_jni(  174): surfaceCreated
V/RenderScript_jni(  174): surfaceChanged
I/ActivityManager(   92): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.pascal.androidlcl/.AndroidLCLTest } from pid 174
I/ActivityManager(   92): Start proc com.pascal.androidlcl for activity com.pascal.androidlcl/.AndroidLCLTest: pid=14567 uid=10072 gids={}
V/AndroidPipesComm:(14567): Executing application /data/data/com.pascal.androidlcl/lib/libandroidlcltest.so copied to /data/data/com.pascal.androidlcl/files/androidlcltest
V/RenderScript_jni(  174): surfaceDestroyed
V/AndroidPipesComm:(14567): WaitForPascalMessage(amkActivityCallback, ams_ActivityCallback_onCreateFinished)
V/AndroidPipesComm:(14567): START WaitForPascalMessage AExpectedMessageType=0 AExpectedMessageSubtype=1001
V/AndroidPipesComm:(14567): [WaitAndProcessPascalMessage] EOFException=null
I/ActivityManager(   92): Process com.pascal.androidlcl (pid 14567) has died.
V/RenderScript_jni(  174): surfaceCreated
V/RenderScript_jni(  174): surfaceChanged
W/InputManagerService(   92): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@406b4490
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 07:37:06 pm
Could you give me some info about your pascal executable? For example:

cd libs/armeabi
ls -l
file libandroidlcltest.so
ldd libandroidlcltest.so

And post all results here.

Did you include debug info in the executable? I remember that if you put Debug info it might get too heavy to run.

Do you have any other device to test?
Title: Re: First steps of LCL-Android are ready
Post by: IndianaJones on August 25, 2011, 08:33:28 pm
Here are the outputs.

cd libs/armeabi
ls -l

drwxr-xr-x 3 indianajones indianajones    4096 Aug 25 10:15 .
drwxr-xr-x 4 indianajones indianajones    4096 Aug 25 10:06 ..
-rwxr-xr-x 1 indianajones indianajones 4817652 Aug 25 10:15 libandroidlcltest.so
drwxr-xr-x 6 indianajones indianajones    4096 Aug 25 10:06 .svn
indianajones@mars ~/android/androidlcl/android/libs/armeabi $ pwd
/home/indianajones/android/androidlcl/android/libs/armeabi

============================================================

indianajones@mars ~/android/androidlcl/android/libs/armeabi $ file libandroidlcltest.so
libandroidlcltest.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped

====================================================================

indianajones@mars ~/android/androidlcl/android/libs/armeabi $ ldd libandroidlcltest.so
   linux-gate.so.1 =>  (0xb76e8000)
   libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb76b7000)
   libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb757c000)
   libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb755b000)
   libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb7177000)
   libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb70dc000)
   libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb7093000)
   libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb6fba000)
   libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6fb4000)
   libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb6fb0000)
   libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb6f65000)
   libatk-1.0.so.0 => /usr/lib/i386-linux-gnu/libatk-1.0.so.0 (0xb6f45000)
   libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb6e92000)
   libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb6e8d000)
   libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb6d33000)
   /lib/ld-linux.so.2 (0xb76e9000)
   libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb6d14000)
   libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0xb6c0e000)
   librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb6c05000)
   libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb6bde000)
   libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb6bd2000)
   libXcomposite.so.1 => /usr/lib/i386-linux-gnu/libXcomposite.so.1 (0xb6bcf000)
   libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb6bcc000)
   libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb6bc6000)
   libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb6b98000)
   libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb6b01000)
   libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6ad2000)
   libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb6ac0000)
   libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb6ab6000)
   libXinerama.so.1 => /usr/lib/i386-linux-gnu/libXinerama.so.1 (0xb6ab2000)
   libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb6aa3000)
   libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xb6a9b000)
   libXcursor.so.1 => /usr/lib/i386-linux-gnu/libXcursor.so.1 (0xb6a91000)
   libpcre.so.3 => /lib/libpcre.so.3 (0xb6a54000)
   libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb69e7000)
   libpng12.so.0 => /lib/libpng12.so.0 (0xb69be000)
   libxcb-shm.so.0 => /usr/lib/i386-linux-gnu/libxcb-shm.so.0 (0xb69bb000)
   libxcb-render.so.0 => /usr/lib/i386-linux-gnu/libxcb-render.so.0 (0xb69b2000)
   libz.so.1 => /usr/lib/libz.so.1 (0xb699e000)
   libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb699a000)
   libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb6994000)
   libresolv.so.2 => /lib/i386-linux-gnu/i686/cmov/libresolv.so.2 (0xb6980000)
   libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb6961000)
   libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb693b000)

============================================================

I can test with another machine which is not Android 2.3.4 at the weekend.
Thanks.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 25, 2011, 10:36:20 pm
That is not an Android executable, it is a x86-linux executable compiled with the Gtk2 widgetset.

Please do the following:

1> Open the menu Project -> Project Options
2> Select the build mode "Android"
3> Select the widgetset android if not yet selected
4> Set the tab to Linking (maybe linking, not sure)
5> Set the OS to linux
6> Set the CPU to arm
7> Rebuild the executable with Build from Lazarus
8> Rebuild the package with ant debug
9> Uninstall the app and install it again in the phone
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 26, 2011, 08:18:40 am
Hi felipemdc ,
1> Open the menu Project -> Project Options

What about Tools/Configure build Lazarus?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 26, 2011, 08:28:58 am
What about Tools/Configure build Lazarus?

This dialog is for building the Lazarus IDE, not for building your project and also not for building the LCL in 0.9.31, so I find it extremely unlikely that you want do set anything regarding Android there. The IDE cannot run in Android for multiple reasons.
Title: Re: First steps of LCL-Android are ready
Post by: laguna on August 26, 2011, 09:28:01 am
Hello Felipe, I modified this script to install Lazarus and FPC251 into user folder in Ubuntu.

But it is still not fully functional, you may kindly fix it, so as to incorporate the necessary files for Android!?

Thanks for everything.

by Laguna
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 26, 2011, 10:14:55 am
I added a lot of documentation in the wiki for those issues about building for the wrong architecture:

http://wiki.lazarus.freepascal.org/Android_Interface#How_to_build_an_LCL-Android_application

http://wiki.lazarus.freepascal.org/Android_Interface#Oh_no.21_My_LCL-Android_application_doesn.27t_work
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 26, 2011, 10:16:19 am
Hello Felipe, I modified this script to install Lazarus and FPC251 into user folder in Ubuntu.

But it is still not fully functional, you may kindly fix it, so as to incorporate the necessary files for Android!?

Could you say what exactly doesn't work, in which part it stops (and copy some parts of the script here), etc, and formulate a more specific question? I use Mandriva, not Ubuntu, and I guess this script is Ubuntu specific (not sure, however).
Title: Re: First steps of LCL-Android are ready
Post by: laguna on August 26, 2011, 12:12:29 pm
The script is also good for Mandriva.
Must remove the "Install dependencies" with the following lines "sudo apt-"
With some tweaking this script may be useful to many, is using Mandriva Ubuntu or other distribution.
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 30, 2011, 04:37:10 am
Hi felipemdc
I have met an error After I set Target Os:Linux,Target CPU:ARM .
Code: [Select]
/home/hotcyy/lazarus/fpc/binutils/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/home/hotcyy/lazarus/fpc/binutils/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/home/hotcyy/lazarus/fpc/binutils/ld: cannot find -lpthread
androidlcltest.lpr(21) Error: Error while linking
androidlcltest.lpr(21) Fatal: There were 1 errors compiling module, stopping

ld is an soft link:ln /usr/local/bin/arm-linux-ld  /home/hotcyy/lazarus/fpc/binutils/ld.
My System is Ubuntu ,I try to  install libthread-devel ,gtk2-devel,libc6-devel to solve the problem ,but It does not work. Do you have any idea?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 30, 2011, 08:00:00 am
Strange, do you have local modifications in the project? Could you show your file androidlcltest.lpr?

This error is associated with the unit cthreads being present in the project, but in an unmodified androidlcltest it should not occur.
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 30, 2011, 10:07:33 am
Hi felipemdc  .Before the previous error, there is an error like that  :
Code: [Select]
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(236,76) Error: range check error while evaluating constants
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(260,76) Error: range check error while evaluating constants
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(284,76) Error: range check error while evaluating constants
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(323,76) Error: range check error while evaluating constants
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(348,92) Error: range check error while evaluating constants
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(362,15) Hint: Local variable "Msg" does not seem to be initialized
/home/hotcyy/lazarus/lcl/interfaces/android/androidprivate.pas(388) Fatal: There were 5 errors compiling module, stopping

please help me solve this problem first ! Thank you !
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 30, 2011, 10:41:18 am
I delete the WRAP_CONTET{} ,so it works.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 30, 2011, 11:07:01 am
Indeed, there was a potential range check error, I fixed in the latest svn
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 30, 2011, 11:21:15 am
felipemdc   ,So Another error occures:
 
Code: [Select]
android/androidwsfactory.pas(112,3) Fatal: Can't find unit androidwsforms used by androidwsfactory
the  File "/home/hotcyy/lazarus/lcl/interfaces/android/androidwsforms.pp" not found. but My Lazarus is 0.9.31 .   Why? Thanks
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 30, 2011, 11:50:20 am
ops, I had forgotten to add those files =D I just added them in rev32109
Title: Re: First steps of LCL-Android are ready
Post by: Jonathan on August 31, 2011, 10:08:51 am
Hi felipemdc,I have worked out the application ! Thanks for your help.  Great Job!
Title: Re: First steps of LCL-Android are ready
Post by: laguna on August 31, 2011, 06:01:43 pm
Is possible developer application Android in Windows Seven?

what tools should I download?

Thanks
Title: Re: First steps of LCL-Android are ready
Post by: woma1 on August 31, 2011, 08:26:50 pm
Hi

And I join me to the question of the LAGUNA. Is it possible to write applications for Android in Windows 7?

DUDUS
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 31, 2011, 09:03:53 pm
You should start with:

1> Android-SDK
2> Ant
3> Make sure you can compile the java part of the test project lazarus-ccr/examples/androidlcl
4> Build a cross-compiler for arm-linux (2.5.1+)
5> Obtain Lazarus SVN
Title: Re: First steps of LCL-Android are ready
Post by: laguna on August 31, 2011, 09:34:42 pm
can show step 2 and 4

Thanks
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on August 31, 2011, 09:41:19 pm
step 2 is not at all specific to Lazarus, so you might want to search in google for "Android programming in Windows" or something like that. Try minimal instructions to set up the build environment and try to build the project lazarus-ccr/examples/androidlcl/android

I don't know how to install ant in Windows, it was hard enough to install it in Linux where you already have all packages in the repository. In linux you just install ant and then try to install as much as possible from Java packages until it starts working.

For step 4: http://wiki.lazarus.freepascal.org/Cross_compiling#To_Linux_2

but it just points to the buildfaq ... the fpc-pascal mailling list might come handy.

In short, I honestly think it is much easier to install Virtual PC and install Linux inside it, or install a dual boot in your computer then to build Android apps in Windows.
Title: Re: First steps of LCL-Android are ready
Post by: Zaher on September 11, 2011, 03:53:47 am
Oh, so i need to buy new device, i hate the emulators :D
Title: Re: First steps of LCL-Android are ready
Post by: LA.Center on September 28, 2011, 05:58:13 pm
are there instructions somewhere from A..Z to the final APK file that I can use to create Android apps. You know kind of 1, 2, 3. steps are much appreciated.

Thx

PS: Are Standard controls supported?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on September 28, 2011, 06:02:18 pm
are there instructions somewhere from A..Z to the final APK file that I can use to create Android apps. You know kind of 1, 2, 3. steps are much appreciated.

Use these steps to build the example project:

http://wiki.lazarus.freepascal.org/Android_Interface#Compiling_the_example_LCL-Android_Application

To create a new project simply copy and modify this example project.

Quote
PS: Are Standard controls supported?

What do you mean by that? Assuming that you are asking if LCL controls of the Standard tab are supported, then the answer is: This table contains the status of which controls are already implemented:

http://wiki.lazarus.freepascal.org/Roadmap#Status_of_native_controls_on_each_widgetset
Title: Re: First steps of LCL-Android are ready
Post by: LA.Center on September 28, 2011, 06:13:21 pm
ok, I see, thx for the info, one last question, can I paint on the Form Canvas?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on September 28, 2011, 06:19:44 pm
ok, I see, thx for the info, one last question, can I paint on the Form Canvas?

TCanvas is not yet supported, although obviously it is a top item to be done.
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 27, 2011, 09:38:29 am
Hi felipemdc!
I can not compile the sample application androidlcl, shows the following error.

/usr/local/bin/arm-linux-ld: warning: /home/predator/Android/androidlcl/android/libs/armeabi/link.res contains output sections; did you forget -T?
/usr/local/bin/arm-linux-ld: /usr/arm-linux-gnueabi/lib/libc.so.6: Unknown mandatory EABI object attribute 44
/usr/local/bin/arm-linux-ld: failed to merge target specific data of file /usr/arm-linux-gnueabi/lib/libc.so.6
/usr/lib/fpc/2.4.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/usr/lib/fpc/2.4.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
androidlcltest.lpr(21) Error: Error while linking
androidlcltest.lpr(21) Fatal: There were 1 errors compiling module, stopping

And the compiler and Lazarus assembled correctly, as turbochessclock4android compiled and running on the Android emulator.

I noticed that this error is associated with static and dynamic libraries such as crti.o crtn.o libc.so. .., it is checked by substituting different versions of the library, from which we take these libraries?

Errors have been tested for Ubuntu 10.10-10.04
compiler to 2.4.4, 2.7.1
Lazarus 0.9.31.32791
BinUtils 2.20-2.21-2.21.1

Привет felipemdc!
Я не могу скомпилировать демонстрационное приложение androidlcl, появляются следующие ошибки.
--//--
Причем компилятор и лазарус собраны правильно, так как turbochessclock4android скомпилировалось и работает на Андроид эмуляторе.
Я заметил что данная ошибка связана со статическими и динамическими библиотеками такими как crti.o crtn.o libc.so...,это проверено путем подмены разных версий библиотеки, откуда следует брать эти библиотеки?
Ошибки были проверены на Ubuntu 10.10-10.04
на компиляторе 2.4.4, 2.7.1
Лазарус 0.9.31.32791
BinUtils 2.20-2.21-2.21.1
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on October 27, 2011, 10:08:34 am
/usr/local/bin/arm-linux-ld: failed to merge target specific data of file /usr/arm-linux-gnueabi/lib/libc.so.6
/usr/lib/fpc/2.4.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':

Free Pascal 2.4.4 is broken for Android. You *must* use 2.5.x or 2.6.x. For example from the pre-compiled installer which is in the wiki:

http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre-compiled_compiler
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 27, 2011, 10:17:04 am
/usr/local/bin/arm-linux-ld: failed to merge target specific data of file /usr/arm-linux-gnueabi/lib/libc.so.6
/usr/lib/fpc/2.4.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':

Free Pascal 2.4.4 is broken for Android. You *must* use 2.5.x or 2.6.x. For example from the pre-compiled installer which is in the wiki:

http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre-compiled_compiler
Compiler 2.7.1 from source good?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on October 27, 2011, 10:41:50 am
Compiler 2.7.1 from source good?

Well, you can try that, but I think that then Unicode support will be broken.

Lazarus does not yet support 2.7 because 2.7 is under development with a final state not yet decided. So supporting it makes no sense, since it will change and then we would have to adapt again.
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 27, 2011, 10:48:38 am
Compiler 2.7.1 from source good?

Well, you can try that, but I think that then Unicode support will be broken.

Lazarus does not yet support 2.7 because 2.7 is under development with a final state not yet decided. So supporting it makes no sense, since it will change and then we would have to adapt again.
Thanks, I'll try with 2.5.1. I hope to succeed!
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 27, 2011, 11:34:27 am
I rebuilt everything as is done in the wiki there was this error:
androidlcltest.lpr(21) Error: Assembler /home/predator/lazarus/fpc/binutils/as not found, switching to external assembling

If you remove the parameter
-XP/home/predator/lazarus/fpc/binutils /
out. fpc. cfg that will past mistakes.

/usr/local/bin/arm-linux-ld: /usr/arm-linux-gnueabi/lib/libc.so.6: Unknown mandatory EABI object attribute 44
/usr/local/bin/arm-linux-ld: failed to merge target specific data of file /usr/arm-linux-gnueabi/lib/libc.so.6
/usr/lib/fpc/2.5.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/usr/lib/fpc/2.5.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
androidlcltest.lpr(21) Error: Error while linking
androidlcltest.lpr(21) Fatal: There were 1 errors compiling module, stopping

/ usr / arm-linux-gnueabi / lib /

This is the path to the libraries from the package in ubuntu Libc6Armelcross.deb
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 27, 2011, 07:48:25 pm
I used the original when the compiler 2.5.1 from here:
http://svn.freepascal.org/svn/fpc/branches/fixes_2_6/
Are there any ideas where to dig?
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on October 27, 2011, 08:48:03 pm
If you do this:

1> Svn update your Lazarus

2> Open the package LCLBase (you can find it in the menu Packages->Graph), then go to Options, then go to "Other" and put there this: -dAndroid

does it compile then?
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 28, 2011, 06:50:47 am
If you do this:

1> Svn update your Lazarus

2> Open the package LCLBase (you can find it in the menu Packages->Graph), then go to Options, then go to "Other" and put there this: -dAndroid

does it compile then?

1) It did not work 0.9.31.33121
2) Select this option, the project compiled!

MORE BIG THANK YOU!

I used this one for manual assembly under android
http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM
It is only now looking at
http://wiki.freepascal.org/Android_Interface
I noticed the item-dAndroid

Sorry!
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on October 28, 2011, 06:58:13 am
1) It did not work 0.9.31.33121
2) Select this option, the project compiled!

It was not one or the other, it was first 1 then 2 =D

The problem is that by default Lazarus installs a C WideString Manager in UNIXes for WideString support, but this widestring manager links to the C library =( And that sucks for cross-compiling.

We don't need that for Android because I have written a new 100% Pascal WideString Manager. And that is what is activated by -dAndroid (along with deactivating the other widestring manager). I updated the instructions for this new step.

Quote
It is only now looking at
http://wiki.freepascal.org/Android_Interface
I noticed the item-dAndroid

I just added it there yesterday =D But it is not a permanent step, we should work on killing this step in the future. I'd like arm-linux to always use the Pascal WideString Manager, but I am still waiting a bit before making it the default for all arm-linux because it impacts non-Android users too.
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 28, 2011, 08:22:36 am
It is clear, thanks!

Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 31, 2011, 06:17:31 am
Hi! I've used Lazarus from the repository
http://svn.freepascal.org/svn/lazarus/trunk
and I was able to compile the application but for some reason it will not start!
Then I used the source
lazarus-0.9.31-32 793-20111010-src.zip
And the application was compiled normally, and earned on the android emulator!
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on October 31, 2011, 09:01:01 am
So, are you saying that lazarus-0.9.31-32 793-20111010-src.zip works?

And http://svn.freepascal.org/svn/lazarus/trunk not. Correct?

What does adb say? Write:

./adb logcat

from the sdk directory where adb is. Then try to run the app. And check what it says when the application runs.
Title: Re: First steps of LCL-Android are ready
Post by: Rustam Asmandiarov on October 31, 2011, 11:48:10 am
Hmm, now updated to 33 190 and it works!
Title: Re: First steps of LCL-Android are ready
Post by: test_user on November 10, 2011, 10:18:41 pm
first of all, thanks a lot for ability to run pascal app under Android. :)  But when I tried to compile example project (or some other with target os = linux, CPU = arm) I've received error "Error: ppcarm.exe can't be executed, error message: Failed to ", and when I tried Test Project options I've received errors: "compiled FPC unit not found: system.ppu".Has someone been experienced with same issue? Does anybody know, how to resolve it? Thanks in advanced.
Title: Re: First steps of LCL-Android are ready
Post by: felipemdc on November 11, 2011, 05:44:46 am
Did you follow the step-by-step instructions? In which step exactly did you have trouble?
Title: Re: First steps of LCL-Android are ready
Post by: test_user on November 14, 2011, 09:09:53 pm
Yes, i tried to fallow the instruction. (some parts of it describe only installation under Linux only). But when I tried to compile test project (or setup compilation configuration for android for new project), i've received errors, described above :(. Could someone provide me with steps for installation under win 7? Or what should i do to avoid errors?
TinyPortal © 2005-2018