Reputation: 308
I got the MissingPlugin error. I found quite some posts about the error. But my case is a bit different. First, my project runs fine in simulator, the error only raises when I run my release app on physical Android. Second, this error is not just related to one package. I first got error like MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) After I put the code I found only to handle the issue with shared_preferences. I then got error like MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/package_info) Obviously the error is not just linked to one package like shared_preferences.
Any idea? how can I solve the problem?
Upvotes: 8
Views: 36073
Reputation: 149
have same issue, fixed it by remove reduant plugin directive:
before:
flutter:
uses-material-design: true
plugin:
platforms:
android:
package: com.kasem.receive_sharing_intent
pluginClass: ReceiveSharingIntentPlugin
assets:
- assets/i18n/
after:
flutter:
uses-material-design: true
assets:
- assets/i18n/
Upvotes: 0
Reputation: 20231
I had a same error on a old flutter app, Running on stable 3.0.2 without null safety. As a result I was using shared_preferences : ^5.4
which worked well in debug, but used to crash the plugin in release mode on Android
Adding
minifyEnabled false
shrinkResources false
to android/app/build.gradle
fixed the issue
Upvotes: 2
Reputation: 81
There's absent super.configureFlutterEngine(flutterEngine)
on FlutterActivity
.
class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine) //missing this
}
}
Upvotes: 8
Reputation: 308
Tried a few different solution found online, like clean and rebuild. no-shrink etc. None worked for me.
Finally in the build.gradle, I changed
classpath 'com.android.tools.build:gradle:4.0.0' to classpath 'com.android.tools.build:gradle:3.5.1'
after that, the apk size is 50% of the previous and the app loads fine.
So maybe something with the new build tool.
Upvotes: 3
Reputation: 525
This is a classic mistake that allot of people make. What you are trying to do is abstract heavy work to an isolate, however flutter isolates cannot run plugins, other than the api in flutter and the dart sdk directly.
You have a couple of options.
This plugin creates isolates that auto marshal plugin work back to the main isolate, without risking a runtime exception that base flutter isolates will normally throw.
Upvotes: 5