-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library "libsqlitejdbc.so" not found on Android #797
Comments
Can you clarify, i don't understand |
About android native library https://developer.android.com/studio/projects/add-native-code Then android loads the native library from arm64-v8a if the android MCU is aarch64 type. The source from sqlite-jdbc GitHub android native directory as follow: |
The link you provided doesn't explain anything about the directories. The directory names in sqlite-jdbc are used to perform a lookup depending on the OS/arch detected, then the corresponding native library is copied to a temp directory. I don't see how changing the directories where the native lib is stored would change anything. |
https://developer.android.com/ndk/guides/abis#gradle ABI management on the Android platform Native code in app packages /lib/"abi name"/lib.so. <====== this is reason Here, is one of the ABI names listed under Supported ABIs, and is the name of the library as you defined it for the LOCAL_MODULE variable in the Android.mk file. Since APK files are just zip files, it is trivial to open them and confirm that the shared native libraries are where they belong. |
I don't think the issue Android UnsatisfiedLinkError #248 is done. |
In that case the problem is more about how the lib is loaded for Android than just the directory name. The articles you provide describe native libs that are within the project, but not really about native libs that are within a dependency though. |
So currently if i use
I need to add jniLibs to myapp source:
I think this should be included in the jar file. |
I was checking this in Android Studio, and i think the problem lies elsewhere. When i opened the APK generated by Android Studio, i can see the Mac and Windows native libraries in I have a feeling that they are excluded by Gradle automatically because they are |
I couldn't fathom how the library loading worked, and i just found out that specific bit of code for Android. When Android is detected, it uses My understanding is that
I feel like this is not an issue, but should be properly documented. There's no way the jar can provide the android libraries in the right folder AFAIK. If you can find a way for a third-party dependency to provide native libs for Android, we can evaluate a change. |
I also found this: https://developer.android.com/studio/releases/gradle-plugin#extractNativeLibs I haven't found how to keep the Ideally what we should have is a way to automatically:
That would be however outside of the scope of this project, and should probably be handled by a dedicated Gradle plugin for Android. |
I'll try how can finish read .so file from the jar file and report it here. Thanks |
🎉 This issue has been resolved in |
Describe the bug
Run on the android platform will issue this bug
To Reproduce
Connect SQLite DB with sqlite-jdbc from the Android platform.
Logs
2022-10-12 11:27:01.122 16877-16877/com.demo.sqlite E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.demo.sqlite, PID: 16877
java.lang.UnsatisfiedLinkError: dlopen failed: library "libsqlitejdbc.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
at java.lang.Runtime.loadLibrary0(Runtime.java:998)
at java.lang.System.loadLibrary(System.java:1656)
at org.sqlite.core.NativeDB.(NativeDB.java:40)
at org.sqlite.core.NativeDB.load(NativeDB.java:60)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:281)
at org.sqlite.SQLiteConnection.(SQLiteConnection.java:68)
at org.sqlite.jdbc3.JDBC3Connection.(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.(JDBC4Connection.java:19)
at org.sqlite.JDBC.createConnection(JDBC.java:104)
at org.sqlite.SQLiteConfig.createConnection(SQLiteConfig.java:108)
Environment (please complete the following information):
OS: [Android 12]
CPU architecture: [aarch64]
sqlite-jdbc version [3.39.3.0]
Additional context
About Android ABI description:
https://developer.android.com/ndk/guides/abis
The android native library directory name needs to be corrected.
/org/sqlite/native/Linux-Android
aarch64 -> arm64-v8a
arm -> armeabi-v7a
x86
x86_64
I have tested it, It's working now on Android.
The text was updated successfully, but these errors were encountered: