Recent

Author Topic: LAMW problem - apk crashes  (Read 545 times)

wywong

  • New Member
  • *
  • Posts: 16
LAMW problem - apk crashes
« on: February 26, 2020, 08:45:02 am »
I built Laz4android with LAWM for windows and followed the instructions at https://wiki.lazarus.freepascal.org/Android_tutorial to build the example android app Androidlcltest. The app runs well in a virtual device running Android 4.2.2 (API-17), but it stops/crashes upon launch on all other devices I tried:

a. virtual device running Android 5.1.1 (API-22),
b. virtual device running Android 2.2 (API-8),
c. LG P690f running Android 2.3.2 (API-8),
d. Blackview A20 running Android Go (API-26).

It fails to install on Kobo Arc 7 eReader running 4.2.2. The crash report for (a) has this line:

Quote
I/DEBUG   (   60): Abort message: 'art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: native code passing in reference to invalid stack indirect reference table or invalid reference: 0xbe82a0a0'

The complete logcat can be seen at https://forum.lazarus.freepascal.org/index.php/topic,48605.msg350551.html#msg350551.

I have tried JDK versions 1.6.030, 1.6.045, & 1.8.241, NDK 10e, 11c, 13b, & 18b, SDK platforms Android-8, Android-17, & Android-21. All have the same problem. I tried to find NDK-r9 as mentioned in the tutorial but r10e is the earliest I can find.


DonAlfredo

  • Hero Member
  • *****
  • Posts: 1300
Re: LAMW problem - apk crashes
« Reply #1 on: February 26, 2020, 09:57:23 am »
This error can be caused if you have build for armeabi (armv6).
And the devices need armeabi-v7a.

Sidenote:
Please stay tuned.
I have committed many updates towards LAMW to make it run slightly better.
Also, a major update of fpcupdeluxe is to be expected. This update has been tuned for a more or less easy install of LAMW + ant + gradle. And an easy configuration with an Android NDK and SDK.

wywong

  • New Member
  • *
  • Posts: 16
Re: LAMW problem - apk crashes
« Reply #2 on: February 27, 2020, 10:57:14 am »
I changed the Config and Target Option|Target processor to ARMV7A, the ditto to Custom Options, but got the same crash. Is there any other change needed?

I noticed that when running build_debug_apk.bat, I got this warning:
Quote
d:\androidlcl\android>call java -Djava.ext.dirs=d:\AndSDKtools\platform-tools\lib\ -jar d:\AndSDKtools\build-tools\17.0.0\lib\dx.jar --dex --verbose --output=D:\androidlcl\android\bin\classes.dex D:\androidlcl\android\bin\classes

THIS TOOL IS DEPRECATED. See --help for more information.
Is that responsible for the crash? I have tried JDK 1.6.0_30 and 1.8.0_241.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1300
Re: LAMW problem - apk crashes
« Reply #3 on: February 27, 2020, 11:12:38 am »
Please try fpcupdeluxe. This is a pre-release (1.6.8c). You might use it and test it.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.8c/fpcupdeluxe-i386-win32.exe

Choose an install-directory.
Choose FPC trunk and Lazarus trunk.
Press install/update FPC + Laz button.
If finished, goto Cross-tab.
Choose arm and android.
Press Install Compiler.
If finished, goto Modules-tab.
Choose lamw.
Press Install Module.

If all went well, you are ready to go.
If asked for, please point Lazarus towards ndk and sdk (and gradle).

I can succesfully run nearly all lamw-demos on Android devices, with both armv7a and aarch64.
(java sdk 1.8.0_241)

wywong

  • New Member
  • *
  • Posts: 16
Re: LAMW problem - apk crashes
« Reply #4 on: February 29, 2020, 11:33:57 pm »
I tried fpcupdeluxe and it was wonderful!

I encountered a few minor problems. I list them below in case they might be helpful to others.

a. Initially fpcupdeluxe got stuck (not responding) at a random position during downloading. I needed to force exit and retry, but still could not make it to the end after several attempts. It seems to be internet related. Switching to Wifi (was wired) did the trick.

b. loading project demos\Console\ConsoleAppDemo1 crashed Lazarus ("" is not a valid integer). Avoid!

c. when loading any demo android projeccts (in ccr\lamw\demos\GUI), I got this message box:
Quote
Error. Gradle version is empty
That was solved by setting Gradle path thus: Tools|[LAMW] Android Module Wizard|Paths settings

d. when building said android projects, I got this error
Quote
Cannot find system used by [project name]. Make sure all ppu files of a package are in its output directory. ppu in wrong directory...
Changing Project Options|[LAMW] Android Project Options|Build|Chipset to ARMV7a+VFPv3 solved the problem. Orginal setting of ARMV7a+Soft won't work.

e. Building APK (Ant) failed when Target SDK version was set too low (e.g. Android-17).

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1300
Re: LAMW problem - apk crashes
« Reply #5 on: March 01, 2020, 06:29:48 am »
Good to see that this worked out for you.
I guess the errors encountered are related to Gradle not found (due to a download error).

FYI.
I have completely switched from ANT towards Gradle for building APK.
ANT is no longer supported by Google and Gradle is.
Besides, Gradle can build also universal APK's.

I am now investigating if Kotlin can be easily integrated into LAMW. Its much closer to Pascal.

 

TinyPortal © 2005-2018