-
Notifications
You must be signed in to change notification settings - Fork 75
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
[sqlcipher_flutter_libs] openCipherOnAndroid not working on Android 6 #55
Comments
What the hell is Android doing here? 😧 But it's interesting to know that the object gets put there...
Are you using the function before |
I'm not sure... 🙈
The stacktrace is
The reason that this only fails on some devices is that the workaround only calls
I'll try removing the preresolve next week, but this has quite a few implications in the app and will still result in using a workaround, which I don't really like 🤔 (not that my suggestion is fool-proof 😬) |
From the stack trace, it looks like you're opening the native library in a new isolate. That's completely fine, but it means that you also need to call If possible, an alternative would be to always open the library in the main isolate (even if it's not used there). Once opened correctly, the default path attempting to open |
I think it has something to do with aab files. I built the apk and installed it with adb. And everything works fine. If I download the app from the playstore. -> AAB -> the database doesn't work. On a side note. We are also using obfuscation in dart & android. But again that works perfectly when building the aab files. I am using a Nexus 5 (Phone) & Nexus 7 (Tablet). Both have this issue (reproducable when using the playstore) |
@simolus3 We do have this in our build.gradle
Could that result in issues? |
The App bundles changing the location of the actual library could explain this. Anyway, did you try using |
I am building to the playstore internal test because that is the only place where I can reproduce this issue. The |
Yes, calling I think there were some general issues with using platform channels in background isolates, but AFAIK most of them have been resolved. |
That will be |
|
This is the error I got (After deobfuscation)
|
It has something to do with the aab files. If I build with --split-apk it works perfectly. If I build an aab and upload that one to the playstore it is broken. |
That's unfortunate. Do you start a main UI isolate before starting the background isolate? If you have a chance to await There's a bit more information on this workaround here: simolus3/drift#895 (comment) |
I will try that tomorrow. I have been working on this today for more than 9 hours. I couldn't think straight anymore. 🤞🤞🤞 |
The |
Try calling it before. So in the main isolate before you do |
If we only call We now call
Because calling |
That fixed it and a new release is in the make. Thank you for your support! |
Yes indeed! Thanks again for your support. We do think that this step should be documented somewhere. |
I have added matching warnings to the readme in f05f5d6. |
We received some reports that our app doesn't startup on some Android 6 devices. I've looked into it and found that the
applyWorkaroundToOpenSqlCipherOnOldAndroidVersions
function threw an error. (Null check operator used on a null value
).So I looked into it deeper and after searching for a while I found that there was an issue with the location of the
libsqlcipher.so
file on my emulator with Android 6.If the file can't be found, you check
/data/data/$appId/lib/libsqlcipher.so
. I found the file however in/data/app/$appId-2/lib/x86_64/libsqlcipher.so
. After some testing it was gone and appeared to be in/data/app/$appId-1/lib/x86_64/libsqlcipher.so
. So the int seams to be different some times.So I've put a try catch around
applyWorkaroundToOpenSqlCipherOnOldAndroidVersions
and reworked the functionopenCipherOnAndroid
. This now works fine on my emulatorThe text was updated successfully, but these errors were encountered: