Lazarus

Programming => Operating Systems => Android => Topic started by: schumi on May 06, 2019, 12:50:54 pm

Title: LAMW + mORMot app crash
Post by: schumi on May 06, 2019, 12:50:54 pm
Hi,
it's my first android app, I have install lazarus/FPC trunk with fpcupdeluxe (trunk button) + lamw + mormot.
my app compile and run normaly in the device, but if I add  in uses
SynCommons    ,mORMot  ,mORMotSQLite3, SynSQLite3Static
app crash at startup. Also AppmORMotDemo1 crash.
Someone can help me?

this is my LAMW.ini
[NewProject]
PathToSmartDesigner=C:\fpcupdeluxe\ccr\lamw\android_wizard\smartdesigner
PathToJavaTemplates=C:\fpcupdeluxe\ccr\lamw\android_wizard\smartdesigner\java
PathToJavaJDK=c:\Program Files (x86)\Java\jdk1.8.0_202
PathToAndroidNDK=C:\LAMW\android-ndk-r17c
PathToAndroidSDK=C:\LAMW\android-sdk
PathToAntBin=C:\LAMW\apache-ant-1.10.5\bin
PathToGradle=C:\LAMW\gradle-4.4.1
NDK=5
PrebuildOSYS=windows

sorry for my english
thanks
Title: Re: LAMW + mORMot app crash
Post by: jmpessoa on May 06, 2019, 05:57:01 pm

mORMot + LAMW demo  [by TrueTom]

https://github.com/shenxh/LazAndroidOrmDemo
Title: Re: LAMW + mORMot app crash
Post by: schumi on May 06, 2019, 07:13:34 pm
Quote
https://github.com/shenxh/LazAndroidOrmDemo

I have already downloaded this demo, but something wrong, no server code, nothing refer to mormot :(
Title: Re: LAMW + mORMot app crash
Post by: jmpessoa on May 06, 2019, 08:07:42 pm
Quote
but if I add  in uses
SynCommons    ,mORMot  ,mORMotSQLite3, SynSQLite3Static
app crash at startup.
You can try copy these units to "/jni"  project folder....

Quote
Also AppmORMotDemo1 crash....
yes, this is just the skeleton of an application.... you need complete the project with  all
mORMot stuff. You read this hint here "....\demos\GUI\AppmORMotDemo1\mORMot"
"--putmORMotSourceHere--"
Title: Re: LAMW + mORMot app crash
Post by: schumi on May 06, 2019, 11:44:41 pm
yes, I have copy last git version of mormot in mormot directory, download static folder  from http://synopse.info/files/sqlite3fpc.7z

project option like thi post

https://forum.lazarus.freepascal.org/index.php/topic,33446.msg260242.html#msg260242

but always crash :o

is there any tutorial on fpcupdeluxe/android?

thanks
Title: Re: LAMW + mORMot app crash
Post by: PeterEvans on May 07, 2019, 01:47:22 am
@schumi
With mORMot there are different units for different operating systems.
The unit SynCommons will work with Windows operating system, for example.
For Android you need to use the SynCrossPlatform* units.

Look within the manual "17. Cross-Platform clients" and '17.1.1. Delphi FMX / FreePascal FCL cross-platform support'.
The manual is Synopse    'Software Architecture Design'.

On Android it is not advisable to pull in any Windows mORMot units.
Title: Re: LAMW + mORMot app crash
Post by: hnb on May 07, 2019, 10:32:33 pm
standard mORMot units (Syn*.pas & mORMot*.pas) works fine for Android + LAMW. Try to use older mORMot (October/December 2018), I have some troubles with latest mORMot on Android but not time yet to investigate.

What is your Android version?
What is your mORMot version (exactly version - for version goto SynopseCommit.inc file in mORMot directory)?
What is your FPC revision/version?

also static linking for SQLite3 with Android + mORMot will not work (even SynSQLite3Static.pas has no meaning here - the dynamic so file will be loaded). You need to manually add right version of SQLite3 to your apk. Here you have precompiled binaries: https://www.sqlite.org/download.html (Precompiled Binaries for Android). Change *.aar extension to *.zip and get proper *.so file from archive (probably jni\armeabi-v7a\libsqliteX.so is right choice - but you need to change libsqliteX.so name to libsqlite.so).

Otherwise standard SQLite3 from Android will be loaded.

Title: Re: LAMW + mORMot app crash
Post by: schumi on May 08, 2019, 10:25:05 pm
thanks to everybody for your answears! :)

mormot ver 1.18.5207
FPC trunc 3.3.1 - lazarus trunk 2.1 r61105

I have a mobile device Memor10 with android 8.1, but I try also with other device with android 7.0

what is the last version of FPC/lazarus that works with mORMot /android?
Title: Re: LAMW + mORMot app crash
Post by: truetom on May 09, 2019, 05:06:26 pm
Hi, schumi @schumi

mORMot for Android ,please use this:
https://github.com/shenxh/LazAndroidOrmDemo/tree/master/components/mORMot-Android

mORMot for Windows ,please use this:
https://github.com/shenxh/LazAndroidOrmDemo/tree/master/components/mORMot-Server

My LazAndroidOrmDemo use laz4android1.6 + LAMW(a old version)+ mORMot.
Title: Re: LAMW + mORMot app crash
Post by: hnb on May 10, 2019, 11:03:13 am
I have in production mORMot v1.18.4912 . Your Android seems fine. Required API should be >= 20 because mORMot uses "getpagesize" (https://android.googlesource.com/platform/development/+/8326e0e/ndk/platforms/android-20/arch-arm64/symbols/libc.so.functions.txt) from libc which was introduced in Android 4.4W (not all KitKat versions).
TinyPortal © 2005-2018