-
Notifications
You must be signed in to change notification settings - Fork 565
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
java.lang.UnsatisfiedLinkError: dlopen failed: library "libsqlcipher.so" not found #587
Comments
Hi @iadcialim, What were your results from running the SQLCipher for Android test suite on the Samsung Galaxy A32 5G Android 11? |
hi @developernotes I have difficulty verifying this as I got the device information from firebase crashlytics. |
Hello, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug", "enhancement", or "security" and I will leave it open. Thank you for your contributions. |
There are always going to be some erratic devices that would simply throw an Using |
Hi @ItzNotABug Can you share the full source code? Much appreciated. |
@iadcialim Sure.
class SupportFactory @JvmOverloads constructor(
private val passphrase: ByteArray,
private val hook: SQLiteDatabaseHook? = null,
private val clearPassphrase: Boolean = true
) : SupportSQLiteOpenHelper.Factory {
override fun create(configuration: SupportSQLiteOpenHelper.Configuration): SupportSQLiteOpenHelper {
return SupportHelper(configuration, passphrase, hook, clearPassphrase)
}
}
class SupportHelper internal constructor(
configuration: SupportSQLiteOpenHelper.Configuration,
private val passphrase: ByteArray?, hook: SQLiteDatabaseHook?,
private val clearPassphrase: Boolean
) : SupportSQLiteOpenHelper {
// Other Java to Kotlin converted functions.
companion object {
fun loadSqlCipherLibrary(context: Context, libraryLoadedlistener: (Boolean) -> Unit) {
val libraryName = "sqlcipher"
try {
System.loadLibrary(libraryName)
libraryLoadedlistener(true)
} catch (exception: UnsatisfiedLinkError) {
ReLinker.loadLibrary(context, libraryName, object : ReLinker.LoadListener {
override fun success() = libraryLoadedlistener(true)
override fun failure(t: Throwable?) = libraryLoadedlistener(false)
})
}
}
}
} And use it like before: SupportHelper.loadSqlCipherLibrary(appContext) { succeeded ->
val pass = SQLiteDatabase.getBytes(appContext.strongBlob())
val roomBuilder = Room.databaseBuilder(
appContext, AppDatabase::class.java, "app_database"
)
if (succeeded) roomBuilder.openHelperFactory(SupportFactory(pass))
else {
// other measures..
}
roomBuilder.build().also { INSTANCE = it }
} Note:
|
Getting same issue on the below mentioned version |
Hi, I'm also facing the problem reported above. I'm using version net.zetetic:android-database-sqlcipher:4.5.0.
in this topic it was reported that this problem does not occur in version 4.3.0. https://discuss.zetetic.net/t/link-failure-on-certain-android-devices/4402 I would like to know if it is safe to downgrade until the problem is fixed. @developernotes Further details follow.
Is this answer correct? |
I got same issue on multiple devices, I'm using version net.zetetic:android-database-sqlcipher:4.5.0.
I have been checked apk lib folder, the libsqlcipher.so is exist. can someone help me to fix that? |
Hi @GordonWu Thanks for reaching out, I have a few additional questions regarding your situation:
|
Hi @developernotes Thanks for reply
|
Hi @GordonWu Thanks for your follow-up, that is helpful. Since you are deploying with App Bundles, would you consider another adjustment to the library loading approach with your next release? With ReLinker, would you adjust your usage to provide a |
Thanks for the tip! I will try it for next release. |
Hi @developernotes, There is no luck :( currently i can do for now is try catch when this error occur, cancel db init and disable related functions. |
Hi @GordonWu Thank you for your follow-up, that is unfortunate to hear the |
Yes, I'm use with ReLinker, here the source, the error thrown is at line class SqlCipherInitializer : Initializer<Unit> {
override fun create(context: Context) {
CoroutineScope(Dispatchers.IO).launch {
loadSqlCipherLibrary(context) { succeeded ->
if (!succeeded) {
try {
SplitInstallHelper.loadLibrary(context, "sqlcipher")
return@loadSqlCipherLibrary
} catch (e: Exception) {
return@loadSqlCipherLibrary
}
}
(...some code for init database)
}
}
}
override fun dependencies(): List<Class<out Initializer<*>>> {
return emptyList()
}
private fun loadSqlCipherLibrary(context: Context, libraryLoadedListener: (Boolean) -> Unit) {
val libraryName = "sqlcipher"
try {
System.loadLibrary(libraryName)
libraryLoadedListener(true)
} catch (exception: UnsatisfiedLinkError) {
ReLinker.loadLibrary(context, libraryName, object : ReLinker.LoadListener {
override fun success() = libraryLoadedListener(true)
override fun failure(t: Throwable?) = libraryLoadedListener(false)
})
}
}
} |
hi @ItzNotABug thank you for your info and src code here. i just got back to this issue once again.
Or am I missing something? Thanks |
Hi @developernotes @GordonWu Sorry mates. Im a bit confused on the floating src codes and can't figure out on how to use all of them. Can someone guide me on the correct sequence of steps on applying these workaround? Much appreciated |
Yes, |
Hi, @iadcialim I believe that all floating src codes are pointing to the same thing, we try use So, the core idea is start from b. #587 (comment) , and a. #587 (comment) is more completely code, the last c. #593 (comment) is my current use code BTW, SqlCipherInitializer : Initializer is part of android jetpack's App Startup |
Thank you for your answers @GordonWu |
Ah gosh, @iadcialim I'm very sorry about that, I just noticed now that I'm replying in the wrong order, C. #593 (comment) >>>> B. #587 is my current code, so i do not call this too. |
Ah ok noted @GordonWu thanks mate |
@developernotes Do you know when should we call this? |
Hi @iadcialim
You need to call Footnotes |
Hey @iadcialim , do you know if your minimum sdk was higher than 23? or lower? I'm having a similar issue and was debating if we should add ReLinker or not but the ReLinker's github README indicates that I won't need it if minsdk is higher than 23. |
Hi @jae-12 My minimum sdk is exactly 23. My app is has been live for 3 weeks now and so far my app did not encounter issue on |
I got this error just recently. minSdk = 26, "net.zetetic:android-database-sqlcipher:4.5.4"
Model:Samsung Galaxy A70 Also Nexus 5X Android 12 not rooted affected. |
try this #635 (comment) |
I have the same issue as described here. |
Hi @qsdigor, There appear to be many factors that may cause this issue for some users. Have you tried using ReLinker in conjunction with a call to |
Hi, SQLiteDatabase.loadLibs(_mContext, libraries -> { But I still get this error java.lang.UnsatisfiedLinkError: dlopen failed: library "libsqlcipher.so" not found |
I believe this is related to your existing issue #643. Would you please keep your replies within the same thread? |
Using android-database-sqlcipher:4.4.3 crashes on Samsung Galaxy A32 5G Android 11
The text was updated successfully, but these errors were encountered: