sqlcipher / sqlcipher-android

SQLCipher for Android provides an interface to SQLCipher databases on the Android platform.
Other
123 stars 19 forks source link

UnsatisfiedLinkError: ...couldn't find "libsqlcipher.so" on IRBIS SP511 #8

Open danmov26 opened 1 year ago

danmov26 commented 1 year ago
Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.financialaccounting.fincircle-1/base.apk"],nativeLibraryDirectories=[/data/app/com.financialaccounting.fincircle-1/lib/arm, /system/lib, /vendor/lib, /system/vendor/lib]]] couldn't find "libsqlcipher.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:972)
       at java.lang.System.loadLibrary(System.java:1530)
       at net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(SQLiteDatabase.java:227)
       at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:244)
       at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:223)
       at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:216)
       at net.sqlcipher.database.SupportHelper.<init>(SupportHelper.java:31)
       at net.sqlcipher.database.SupportFactory.create(SupportFactory.java:43)
       at com.financialaccounting.fincircle.data.AppDatabase_Impl.createOpenHelper(AppDatabase_Impl.java:269)
       at androidx.room.RoomDatabase.init(RoomDatabase.java:198)
       at androidx.room.RoomDatabase$Builder.build(RoomDatabase.java:1487)
       at com.financialaccounting.fincircle.functions.ReleaseFunctionsKt.initDatabases(ReleaseFunctions.kt:47)
       at com.financialaccounting.fincircle.App.onCreate(App.kt:149)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
       at android.app.ActivityThread.-wrap2(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6251)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

I already received 168 errors from IRBIS SP511 in Firebase Crashlytics. I use latest version 4.5.2. Help me, please.

This is how my app initilizes AppDatabase in Application class.

sqlite = Room.databaseBuilder(this, AppDatabase::class.java, getIStr(getStr(R.string.sufe6rFN0)))
        .addMigrations(*AppDatabase.ALL_MIGRATIONS)
        .allowMainThreadQueries()
        .openHelperFactory(SupportFactory(SQLiteDatabase.getBytes(getIStr(getStr(R.string.FCb4XhxRv)).toCharArray())))
        .build()
developernotes commented 1 year ago

Hi @danmov26,

You need to perform the following to load the native library prior to invoking any SQLCipher-related API, including Room support:

System.loadLibrary("sqlcipher");
danmov26 commented 1 year ago

Good day, @developernotes. Today I got error from System.loadLibrary("sqlcipher");

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.financialaccounting.fincircle-1/base.apk"],nativeLibraryDirectories=[/data/app/com.financialaccounting.fincircle-1/lib/x86_64, /system/lib64, /vendor/lib64]]] couldn't find "libsqlcipher.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:1001)
       at java.lang.System.loadLibrary(System.java:1562)
       at com.financialaccounting.fincircle.functions.ReleaseFunctionsKt.initDatabases(ReleaseFunctions.kt:64)
       at com.financialaccounting.fincircle.App.onCreate(App.kt:135)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5408)
       at android.app.ActivityThread.-wrap2(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6124)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:780)

Снимок экрана 2022-12-17 202942

com.financialaccounting.fincircle.functions.ReleaseFunctionsKt.initDatabases: And it calls in Application class in onCreate method:

sqlite = try {
        System.loadLibrary("sqlcipher")
        Room.databaseBuilder(this, AppDatabase::class.java, getIStr(getStr(R.string.sufe6rFN0)))
            .addMigrations(*AppDatabase.ALL_MIGRATIONS)
            .allowMainThreadQueries()
            .openHelperFactory(SupportFactory(SQLiteDatabase.getBytes(getIStr(getStr(R.string.FCb4XhxRv)).toCharArray())))
            .build()
    } catch (e: Exception) {
        //
    }

My app - https://play.google.com/store/apps/details?id=com.financialaccounting.fincircle P.S. VPN Russia or Great Britain needed to install.

Please, help me

developernotes commented 1 year ago

Hi @danmov26

Is this issue occurring intermittently, or for all users? If it's intermittent, you might look into utilizing the ReLinker project. We received positive reports from other users who previously experienced java.lang.UnsatisfiedLinkError.

danmov26 commented 1 year ago

Hi @developernotes Intermittent. Only from this Galaxy Tab A, Android 7.1.2.

Ok. Thanks for offer. But by the way, in the Relinker page they write that if min sdk >= 23 (for my app it's true), then System.loadLibrary is safe. Anyway, ok. I'll try it.

richardgarcar commented 1 year ago

Hi @danmov26.

The stracktrace you shared indicates (based on the fact that package has been renamed from net.sqlcipher.database to net.zetetic.database.sqlcipher in this repository and also SupportFactory has been renamed to SupportOpenHelperFactory) that you are using the original android sqlcipher library. Please see a very similar problem that might help you.

sunzhk commented 1 year ago

I also ran into this problem. I found out that this exception is due to the fact that 4.3.0 and later versions of sqlcipher no longer support 32-bit architecture. At present, there are still many Android phones that use 32-bit so libraries. Can you continue to support them?

developernotes commented 1 year ago

Hello @sunzhk,

That is incorrect. SQLCipher for Android supports armeabi-v7a, x86, x86_64, and arm64_v8a architectures. Both armeabi-v7a and x86 are 32-bit architectures.

sunzhk commented 1 year ago

Hi @developernotes I'm so sorry, I made a mistake. I didn't make it clear, what I want is support of the armabi platform。 For some reason our app doesn't support armeabi-v7a. Is there any way to get support for armeabi?

image

developernotes commented 1 year ago

Hi @sunzhk,

The Android NDK removed support for ARMv5 (armeabi) in NDK r17 ^1, so that is no longer supported by the compiler toolchain.

sunzhk commented 1 year ago

Hi @developernotes :

Thank you very much for your answer. I will find a way to make our app support armeabi-v7a.

Thanks again!

UKMIITB commented 9 months ago

Instead of System.loadLibrary, SplitInstallHelper.loadLibrary(context, "sqlcipher") helped us in solving this problem