anboralabs / spatia-room

Implementation of spatia lite database to android component Room
MIT License
41 stars 4 forks source link

"JNI FatalError called: RegisterNatives failed.." App crashing on build gradle 8.4.0 #46

Closed rajeevinimekumar008 closed 2 months ago

rajeevinimekumar008 commented 2 months ago

Hi,

I have been using this library in my project for a while. Recently we have changed our project gradle version from 7.4.2 to 8.4.0. and set targetSDKVersion from 33 to 34.

I am using version 0.2.9 After making a release build with proguard enabled app starts crashing on loading. If i disabled the proguard, it works well.

Stack trace is quite large, but i think this line will make you understand what's happening

Failed to register native method org.spatialite.database.SQLiteConnection.nativeLoadExtension(JLjava/lang/String;Ljava/lang/String;)V in /data/app/~~cPs_Gxfr-OMrE8SkwIMtlQ==/com.yegoglobal.passenger-edSmEpLun6Yp1xnzgdNwjw==/base.apk!classes2.dex jni_internal.cc:825] JNI FatalError called: RegisterNatives failed for 'org/spatialite/database/SQLiteConnection'; aborting...

I have not make any classes keep in proguard files for spatialte-room

Please suggest Thanks

dalgarins commented 2 months ago

Could you create a proof of concept project to reproduce the same issue? I could review and try to fix it.

dalgarins commented 2 months ago

I think I have found the issue, working on it.

dalgarins commented 2 months ago

Could you also exclude from pro guard jni files? @rajeevinimekumar008

rajeevinimekumar008 commented 2 months ago

@dalgarins I able to make it work as of now by adding following line in pro guard

-keep class org.spatialite.database.** { *; }

Do you have any other better solution for this ?

dalgarins commented 2 months ago

No, I don't have a better solution even I'm going to include this -keep class org.spatialite.database.** { *; } to our documentation.