### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook (preview only)

### Author Topic: yes more problems with AndroidLCLtest  (Read 20127 times)

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #15 on: October 17, 2013, 05:20:17 am »
I don't use CodeTyphon but I believe it is based on FPC so if you upload the source code of this example with your settings and your apk file I can try to figure out what went wrong.

#### Leledumbo

• Hero Member
• Posts: 8111
• Programming + Glam Metal + Tae Kwon Do = Me
##### Re: yes more problems with AndroidLCLtest
« Reply #16 on: October 17, 2013, 08:11:42 am »
Try running with adb logcat and paste the log here.

#### kitsaros

• New Member
• Posts: 27
##### Re: yes more problems with AndroidLCLtest
« Reply #17 on: October 17, 2013, 12:16:19 pm »
@engkin here is the hole project :
https://dl.dropboxusercontent.com/u/28434419/androidlcl.zip
The CodeTyphon uses the 2.7.1 FPC version (checked)

@ Leledumbo : the logcat is here :
http://pastebin.com/An984GvW
« Last Edit: October 17, 2013, 12:32:28 pm by kitsaros »

#### BeniBela

• Hero Member
• Posts: 683
##### Re: yes more problems with AndroidLCLtest
« Reply #18 on: October 17, 2013, 01:50:35 pm »
Just give it up

LCL CustomDrawn is completely broken.

And even if it would work, it would still be pointless, because it does not have the look&feel of Android.

The only way to get it working, would be to write a a lcl interface creating standard Android Views with JNI

#### Leledumbo

• Hero Member
• Posts: 8111
• Programming + Glam Metal + Tae Kwon Do = Me
##### Re: yes more problems with AndroidLCLtest
« Reply #19 on: October 17, 2013, 04:34:54 pm »
The core problem can be seen starting from line 1407 in the logcat. Are you trying to access the clipboard? I don't think it's working for Android.
Quote
The only way to get it working, would be to write a a lcl interface creating standard Android Views with JNI
The actual reason custom drawn android was born was because creating LCL interface for Android native controls is not feasible due to differences in controls exist in both framework, or perhaps more than that. You can check attempt before custom drawn era , which calls Android views, here.
« Last Edit: October 17, 2013, 04:36:47 pm by Leledumbo »

#### kitsaros

• New Member
• Posts: 27
##### Re: yes more problems with AndroidLCLtest
« Reply #20 on: October 17, 2013, 05:29:51 pm »
I have redone a test and i get

Code: [Select]
`V/PhoneStatusBar(  133): setLightsOn(true)I/ARMAssembler(   35): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0x41e1c450:0x41e1c6a4] in 770306 nsI/lclapp  (  444): Trying to load liblclapp.soD/dalvikvm(  444): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x41057318D/dalvikvm(  444): Added shared lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x41057318I/lclapp  (  444): JNI_OnLoad calledI/lclapp  (  444): Reading our Activity ClassI/lclapp  (  444): JNI_OnLoad finishedI/lclapp  (  444): LCLOnCreate called by LCLActivity.onCreateI/lclapp  (  444): [TCDWidgetSet.CreateTimer] Result=46BA12A0I/lclapp  (  444): [TCDWidgetSet.DestroyTimer] TimerHandle=46BA12A0 lTimer.NativeHandle=41062BE0 lTimer.NativeGlobalReference=1001CAI/lclapp  (  444): [TCDWidgetSet.CreateTimer] Result=46BA12A0I/lclapp  (  444): [TCDWidgetSet.DestroyTimer] TimerHandle=46BA12A0 lTimer.NativeHandle=41062C90 lTimer.NativeGlobalReference=2001CAW/NetworkManagementSocketTagger(   80): setKernelCountSet(10005, 0) failed with errno -2I/lclapp  (  444): [TCDWSCustomCheckBox.GetPreferredSize] Width=146 Height=38I/lclapp  (  444): [TCDWSCustomCheckBox.GetPreferredSize] Width=146 Height=38I/lclapp  (  444): [TCDWSCustomForm.ShowHide] First form layout adjustment lOldDPI=96 lNewDPI=160 lOldFormWidth=220 lNewFormWidth=100I/WindowManager(   80): createSurface Window{4123bef8 com.pascal.lcltest/com.pascal.lcltest.LCLActivity paused=false}: DRAW NOW PENDINGD/gralloc_goldfish(  444): Emulator without GPU emulation detected.I/lclapp  (  444): [LCLOnConfigurationChanged] i=0 lOldDPI=160 lNewDPI=160 lOldFormWidth=100 lNewFormWidth=480D/dalvikvm(  444): GC_FOR_ALLOC freed 58K, 5% free 6877K/7171K, paused 51msI/dalvikvm-heap(  444): Grow heap (frag case) to 8.143MB for 1395856-byte allocationD/dalvikvm(  444): GC_CONCURRENT freed 2K, 5% free 8238K/8583K, paused 4ms+4msD/dalvikvm(   80): GC_EXPLICIT freed 299K, 8% free 9274K/9991K, paused 7ms+26msW/InputManagerService(   80): Starting input on non-focused client com.android.internal.view.IInputMethodClient\$Stub\$Proxy@411d1ec8 (uid=10005 pid=175)D/dalvikvm(  133): GC_CONCURRENT freed 284K, 6% free 7595K/8007K, paused 6ms+6msI/ActivityManager(   80): Displayed com.pascal.lcltest/.LCLActivity: +3s351msV/PhoneStatusBar(  133): setLightsOn(true)F/libc    (  444): Fatal signal 11 (SIGSEGV) at 0x614c540e (code=1)I/DEBUG   (   33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG   (   33): Build fingerprint: 'generic/sdk/generic:4.0.2/ICS_MR0/229537:eng/test-keys'I/DEBUG   (   33): pid: 444, tid: 444  >>> com.pascal.lcltest <<<`

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #21 on: October 17, 2013, 07:46:46 pm »
@kitsaros, I have both FPC 2.7.1 and NDK r7c. The only changes I did were related to their locations on my computer. The size of liblclapp.so file that I built is around 5 MB (precisely 5,194,207 bytes) while yours is less than 2.7 MB (2,829,591 bytes)

My second guess is that either CodeTyphon is using wrong compiler/linker or your units\arm-android\* were generated using a different NDK (not r7c). With a quick search I saw what makes me think that CT 4.5 is supposed to be used with Android NDK-r8e. Am I right? Try to use NDK-r8e with CT 4.5

Are you trying to access the clipboard? I don't think it's working for Android.

I almost thought the same, but Leledumbo had attached the same sample before and it has the same code!!

Code: [Select]
`procedure Tform1.btnProgressClick(Sender: TObject);var  sqliteDLL : Pointer;begin...  btnProgress.Caption := IntToHex(PtrUInt(sqliteDLL), 8);  DebugLn('Button1Click');  ProgressBar1.Position := ProgressBar1.Position + 10;  DebugLn('Cliboard.AsText='+ClipBoard.AsText);`
Notice that it has the same wrong spelling Cliboard for Clipboard. That's why I don't think it's the sample.

I think this smaller sized .so file is generated using two different  NDK versions, one to compile the sample code and the other was used to compile the other packages units\arm-android\*

#### kitsaros

• New Member
• Posts: 27
##### Re: yes more problems with AndroidLCLtest
« Reply #22 on: October 17, 2013, 09:52:24 pm »
using the android-ndk-r8e
i can compile successfully again the "liblclapp.so" but i get a 2,764 kb file size ... :S

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #23 on: October 18, 2013, 01:03:06 am »
kitsaros, if I'm right, it's not enough to compile using android-ndk-r8e.

The object files that were generated previously need to be deleted so that the source code gets compiled again. I don't know how to do that with CodeTyphon. I tried to figure it out from their wiki. You might want to search your CT directory for a folder named something like arm-android, maybe!!

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #24 on: October 18, 2013, 01:35:12 am »
kitsaros, can you compile that sample for i386 instead of arm CPU? Generate an apk with .so for i386 and uploaded here and I'll be happy to try it.

#### kitsaros

• New Member
• Posts: 27
##### Re: yes more problems with AndroidLCLtest
« Reply #25 on: October 18, 2013, 02:50:32 am »
Changing the CPU family to i386 i get :

c:\codetyphon\fpc\bin\i386-win32\i386-android-ld.exe: skipping incompatible C:\Android\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\crtbegin_so.o when searching for C:\Android\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\crtbegin_so.o

I have recompiled the crosselement (arm-android) and the i386-android obtaining same results

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #26 on: October 18, 2013, 04:52:52 am »
Do you have these two folders?
c:\codetyphon\fpc\units\arm-android
c:\codetyphon\fpc\units\i386-android

I expect that you have the first one, but not the second, yet.

Changing the CPU family to i386 i get :

c:\codetyphon\fpc\bin\i386-win32\i386-android-ld.exe: skipping incompatible C:\Android\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\crtbegin_so.o when searching for C:\Android\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\crtbegin_so.o

You have to choose the correct path. The one you have is for arm CPU. Maybe something like:
C:\Android\android-ndk-r8e\platforms\android-8\arch-x86\usr\lib
C:\Android\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\

if you did not find it within android-8 then simply try android-14:
C:\Android\android-ndk-r8e\platforms\android-14\arch-x86\usr\lib

You'll face the same problem with another path.

I have recompiled the crosselement (arm-android) and the i386-android obtaining same results

These are just the compilers and linkers, not the object files.

#### kitsaros

• New Member
• Posts: 27
##### Re: yes more problems with AndroidLCLtest
« Reply #27 on: October 18, 2013, 05:10:06 am »
Quote
Do you have these two folders?
c:\codetyphon\fpc\units\arm-android
c:\codetyphon\fpc\units\i386-android
Yes

C:\Android\android-ndk-r8e\platforms\android-14\arch-x86\usr\lib\;C:\Android\android-ndk-r8e\toolchains\x86-4.4.3\prebuilt\windows\lib\gcc\i686-linux-android\4.4.3

i get this error :
c:\codetyphon\fpc\bin\i386-win32\i386-android-ld.exe: cannot find -lsqlite3

#### engkin

• Hero Member
• Posts: 2513
##### Re: yes more problems with AndroidLCLtest
« Reply #28 on: October 18, 2013, 05:36:28 am »
See below

(I accidentally editted your message instead of replying. I restored it as good as possible. - marcov)
« Last Edit: October 18, 2013, 11:03:47 am by marcov »

#### marcov

• Global Moderator
• Hero Member
• Posts: 7499
##### Re: yes more problems with AndroidLCLtest
« Reply #29 on: October 18, 2013, 11:04:14 am »