Recent

Author Topic: Application runs on Android API level 8 (Emulator) and crashes on above API  (Read 10247 times)

roeug

  • Jr. Member
  • **
  • Posts: 65
    • http://roeug.50megs.com/
Application runs on Android API level 8 (Emulator) and crashes on above API

fpc 2.6.0 with arm-linux  units 2.5.1

LogCat says:
...
...
..................: I/dalvikvm(14850):   at dalvik.system.NativeStart.main(Native Method)
..................: E/dalvikvm(14850): VM aborting
..................: A/libc(14850): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
..................: I/dalvikvm(14850): threadid=3: reacting to signal 3
...
..................: I/dalvikvm(17335): threadid=3: reacting to signal 3
..................: E/dalvikvm(17335): Unable to open stack trace file '/data/anr/traces.txt': Is a directory
..................: I/dalvikvm(17335): threadid=3: reacting to signal 3
..

How to fix it?
« Last Edit: January 17, 2013, 05:28:50 am by roeug »

picstart

  • Full Member
  • ***
  • Posts: 236
May not be related but I used the lazarus Android Devel VM.hdd and Virtualbox .
I got the example test app to compile. I didn't test in with an android emulator... seemed that might be a bit too optimistic to expect an emulator to work..so I then moved the apk to a real android device but the app did not install the android logcat showed the device at sdk level 7 but the app required sdk8 to run.  What with the thousands of dependencies in lazarus and the multitude within the android development it is a comfort to have gotten this far and failed. I need to discover where the specific sdk comes in and binds to the apk.

roeug

  • Jr. Member
  • **
  • Posts: 65
    • http://roeug.50megs.com/

After svn lazarus everything (everyAPIlevel) seems ok

PS. Noted that
CDWidgetset.ActivityClassName:='com.pascal.lcltest';
should be commented in TheApp.lpr

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Hi,
could you please provide some information how you got it working?

I tried several days to get a working .apk file.

See my attempts here.
Which way did you choose?
http://www.lazarus.freepascal.org/index.php/topic,19302.msg111191.html#msg111191
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

picstart

  • Full Member
  • ***
  • Posts: 236
The lazarus to android isn't as obvious as the lazarus to arm running winCE and later. The winCE port involves a cross compile and that's about it.....sure there are constraints as to the wince display size but more works than doesn't. So for winCe winmobile lazarus lives up to its billing as being multi platform. Linux also works very well with a lazarus port. Even a form of linux on a raspberrypi arm works reasonably well. Android is much more problematical. With the vast numbers of  android devices it is a shame android development with lazarus isn't quite there yet nor has it consolidated into one solid way of doing it. There are many reasons for android being a challenge but android IMHO isn't a viable multiplatform for lazarus.

roeug

  • Jr. Member
  • **
  • Posts: 65
    • http://roeug.50megs.com/
> could you please provide some information how you got it working?

Everything was made in W7HP64rus_locale (Thanks Bill boys! Ubuntu 12.xx fails to install CodeTyphoon)

Read a couple of books about JAVA to be sure in useless of “C++ without pointers” language and about Android. I dare recommend "Cinar O. - Android Apps with Eclipse - 2012" to understand that anyone could code “Hello word” Android application and something like “Android game programming” to understand that Android coding is not funny.
During reading install Eclipse and ADT (Android Development tools with NDK and SDK) – will be useful to test that you have all things needed for Android coding and testing.
Note: You can use adt-bundle-windows-x86_64.zip file if you find it. Don’t forget to install JAVA (be sure that paths are set ok). Note: I use jdk1.6.0_37/jre6 32-bit jdk-6u37-windows-i586.exe. (Sometimes I manually copied java.exe javaw.exe javaws.exe to win/system32 and win/SysWOW64 dirs for compatibility)   
Build some applications from books to launch them on emulators.
 Install CodeTyphoon (I use 3.10) a nice tool for code formatting with syntaxes highlighting.
 Now install Lazarus. I used (at the beginning of happy coding) laz4android1.0.rar 171669325Bytes lazarus1.0 dir time stamp 14:01 24/09/2012 download address: https://skydrive.live.com?cid=89ae6b50650182c6#cid=89AE6B50650182C6&id=89AE6B50650182C6%21129 (Thanks Japan? boys).
Compile examples\androidlcl/nonandroidtest (may be you will need to install components\customdrawn\customdrawn.lpk – install it anyway). Read about CustomDrawn controls in Lazarus.
Compile examples\androidlcl/androidtest
(set path. I have:
(-Fl):…\android-ndk-r7\platforms\android-8\arch-arm\usr\lib;
…android-ndk-r7\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.4.3
Additional parameters: -dANDROID -Xd -CpARMV6
Check output file in androidlcl\android\libs\armeabi\ - it must have liblclapp.so name Exactly!
Build androidlcltest.apk (Check paths in BAT-files, and password in build_debug_apk.bat in the end). It may be useful to run BAT files line by line. (As for me first times there were errors during creating/updating android\bin\classes.dex then I added a line to delete it). Test created androidlcltest.apk on emulator  (adb_install.bat).
Now step by step
1.   Save project dir (androidlcl -> androidlcl##.zip)
2.   Make necessary changes in sources (pas, lfm, lpr, lpi, java, bat…). Note: controls which works are TPanel, TButton, TLabel (be careful with multiline captions), TCDcontrols (Thanks Felippe?)
3.   Compile, run nonandroidlcl.exe
4.   Compile  liblclapp.so, build androidlcltest.apk, install and run in emulator. If crash delete all files in androidlcl, unpack androidlcl##.zip else goto step2.
5.   Load nonandroidlcl project into CodeTyphoon to format the source.
Note: Try to use svn version of Lazarus (not FPC!), compiled with fpc from laz4android1.0.rar, don’t forget install customdrawn.lpk .



DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Thank you for sharing you information.

It scare's me :-)

I have put the ApkManager (developed by "stab") into sourceforge.net
The name "ApkManager" was already taken by another project. Therfor I name it "laztoapk".

http://sourceforge.net/projects/laztoapk/?source=directory

Maybe you want to joint our little project to make developing for android with lazarus become more comfortable ?


Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

nsunny

  • Full Member
  • ***
  • Posts: 116
  • Code is magic
    • LazPlanet
I am having the same problem. I am new in android development. I know almost nothing about Adroid development but (somehow) managed to build the APK.

Done everything accordin to the wiki article.

After svn lazarus everything (everyAPIlevel) seems ok

I am using Lazarus 1.0.10 in Windows XP + pre-compiled FPC 2.5.1 for android/arm. Also: jdk1.6.0_25, jre 7, android-ndk-r7, Android sdk (adt-bundle-windows-x86-20130522). Installed Android 8 API in sdk with SDK manager.

I am using Ant to build the APK. That works fine with the emulator on Android 2.2 (API Level 8), but when I test it with Android 4.1 (API Level 17) it does not work.

As far as I know, it should work on all Androids having API level 8 or greater.

Can you please help me with this? This has been eating my head up.

I am using lclandroid example that comes with Lazarus 1.0.10.

PS. Noted that
CDWidgetset.ActivityClassName:='com.pascal.lcltest';
should be commented in TheApp.lpr

I didn't find it.
Lazarus TTS Tutorial | LazPlanet
Lazarus 1.8 | FPC 3.0 | Win7/Linux

 

TinyPortal © 2005-2018