-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
MissingPluginException on release build #452 #546
MissingPluginException on release build #452 #546
Conversation
…or method getDatabasesPath on channel com.tekartik.sqflite) tekartik#452
Sorry I somehow did not notice this pull request. Would it possible to apply the minify configuration on the example apps in release mode in the same project (either the one in sqflite/example or the one in sqlite_test_app or both!) so that I have a way to validate easily that it works (even if this might sound obvious for you)? Thanks! |
No problem and yep should be possible, I will have a look later today. I will update the PR 👍 . |
thanks @Boehrsi ! |
It seems to be more complicated to reproduce this issue than I initially thought. I tried for the last hours to provoke the error in the example app of the project and within a newly created Flutter example app. And I wasn't able to do so, so my assumption that this is a general problem is refuted. I would say this is good in general, but quite strange in regards to the issue itself, as I wasn't able to pin point the actual configuration which leads to the error. As my own project is affected I tried to copy Gradle configurations, dependencies, plugin embedding setups and multiple other parts to find the problem, but nothing helped. If time allows I will continue testing during the weekend. |
@alextekartik I think I made some progress. It's lets say "complicated". Some findings:
This explains why only some people encounter the problem. To minimize external sources I created a fresh new test app, where I just added |
@@ -35,6 +35,7 @@ android { | |||
defaultConfig { | |||
minSdkVersion 16 | |||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
consumerProguardFiles 'proguard-rules.txt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you comment out this line you will see the problematic MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
exception. With the Proguard rules everything should work.
Even though this seems to fix the symptoms, somebody with more insights should probably verify why there is a problem at all and what is the cause. I can't really tell to be honest why this rules fixes the problem. |
I'm still puzzled by what to do here yet. Maybe adding documentation regarding minification (although I don't have much clue) could help. I'm going to close this pull request for now, sorry. |
Initially I tried to
-keep
just the whole package and played around with the rules. After some tries I got it working and tried to move the rules from my actual app project to the library directly. During this process I realized not the-keep
rule for the package alone was the fix, but also the usage ofgetDefaultProguardFile('proguard-android-optimize.txt')
which I applied during testing.I also tested
getDefaultProguardFile('proguard-android.txt')
and it wasn't working, so I just diffed both and got the needed rule by trial and error. Lastly I also removed the-keep
rule itself and funny enough it was still working.How to easily test in an app
Update pubspec.yaml
Create a minified build, e.g. by just enabling it in debug builds:
To ensure the new stuff is really used some rounds of
flutter clean
orgradlew clean
could be helpful.Additional information