发行版Android中的Flutter中缺少MissingPluginException [英] MissingPluginException in flutter in release mode android
问题描述
当您尝试在发布模式下构建apk时,许多插件都无法正常工作,但是这些插件在调试模式下可以完美运行
Many plugins aren't working in flutter when you try to build a apk in release mode , but these plugins are working perfectly in debug mode
有人建议将gradle版本更改为3.5,但有时使用的插件可能与 file_picker_cross
Some recomend changing the gradle version to 3.5 , but sometimes the plugins used may not be compatible with the same like file_picker_cross
其他人在构建apk时建议使用-no-shrink
选项,即 flutter build apk --release --no-shrink
Others recomend using --no-shrink
option while building the apk i.e flutter build apk --release --no-shrink
这些解决方案都不适合我,我发现这个解决方案埋在github问题对话中
None of that solutions worked for me , i found this solution burried in a github issue conversation
检查以下解决方案
推荐答案
最近扑朔迷离的proguard规则正在弹出未正确注册的插件
Looks like the recent proguard rules in flutter is ejecting the plugins which arent registering properly
在项目的 app/build.gradle
更改
buildTypes {
release {
signingConfig signingConfigs.release
}
}
到
buildTypes {
release {
shrinkResources false
minifyEnabled false
signingConfig signingConfigs.release
}
}
添加的额外两行似乎跳过了proguard规则部分,从而免除了您的噩梦,这只是暂时的解决方法,可能很快就会解决
The added extra 2 lines seems to skip the proguard rules part thereby saving your from the nightmare , this is just a temporary work around , there might be a fix soon from flutter
当然,这会跳过proguard优化,但现在至少可以使用该代码;)
Ofcourse this skips the proguard optimization , but atleast the code works now ;)
我一直在浪费时间将近6个小时,却不知道解决方案,所以我将其发布在这里给其他人
I have been wasting my time for almost 6 hours without knowing the solution ,so I am posting it here for others
这篇关于发行版Android中的Flutter中缺少MissingPluginException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!