I am not quite sure why this is happening - I assume because you are using Kotlin and the value is not nullable.
Problem
Adding a custom application, which is needed for some stuff like android_alarm_manager, like this:
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
When adding this and setting android:name=".Application" in the application tag in the manifest, InAppUpdatePlugin will fail when FlutterFirebaseMessagingService calls this. The error is the following:
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): Failed to handle method call
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): java.lang.IllegalStateException: registrar.activity() must not be null
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): at de.ffuf.in_app_update.InAppUpdatePlugin$Companion.registerWith(InAppUpdatePlugin.kt:27)
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): at de.ffuf.in_app_update.InAppUpdatePlugin.registerWith(Unknown Source:2)
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:44)
E/MethodChannel#plugins.flutter.io/firebase_messaging(12112): at Application.registerWith(Application.java:18)
Reason
The reason I concluded that this plugin is faulty here is that I have 20 other plugins in the project and commenting out the following completely resolves the error:
I am not quite sure why this is happening - I assume because you are using Kotlin and the value is not nullable.
Problem
Adding a custom application, which is needed for some stuff like
android_alarm_manager
, like this:When adding this and setting
android:name=".Application"
in theapplication
tag in the manifest,InAppUpdatePlugin
will fail whenFlutterFirebaseMessagingService
calls this. The error is the following:Reason
The reason I concluded that this plugin is faulty here is that I have 20 other plugins in the project and commenting out the following completely resolves the error:
I could not figure out more about this, but I think that the plugin should be able to handle the scenario.