Closed marcolettieri closed 4 years ago
Are you able to share code or a stack trace? This isn't much to go off of.
2020-01-03 16:09:38.809560+0100 Runner[460:44509] *** Assertion failure in -[GeofencingPlugin startGeofencingService:], /Users/dev/.pub-cache/git/FlutterGeofencing-a8de9075da2f38c79d5c8022dab46ec1bd2ea3f0/ios/Classes/GeofencingPlugin.m:164
2020-01-03 16:09:38.811167+0100 Runner[460:44509] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'
*** First throw call stack:
(0x229447180 0x22861f9f8 0x22936088c 0x229e24b38 0x102e57424 0x102e55d4c 0x10112349c 0x1010bb784 0x101113b68 0x1010cacd0 0x1010cd3c4 0x2293d9554 0x2293d9284 0x2293d8ab8 0x2293d3a08 0x2293d2fb4 0x22b5d479c 0x255c35c38 0x100cbcd00 0x228e968e0)
libc++abi.dylib: terminating with uncaught exception of type NSException
this is the exception raised from xcode. On android i'm able to use the plugin but on some device and with some plugin is raised also an exception:
2020-01-03 16:53:03.708 24265-24265/it.myapp.activity E/AndroidRuntime: FATAL EXCEPTION: main
Process: it.myapp.activity, PID: 24265
java.lang.RuntimeException: Unable to create service io.flutter.plugins.geofencing.GeofencingService: java.lang.IllegalStateException: registrar.activity() must not be null
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3775)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException: registrar.activity() must not be null
at mo.dyna.statusbar.StatusbarPlugin$Companion.registerWith(StatusbarPlugin.kt:23)
at mo.dyna.statusbar.StatusbarPlugin.registerWith(Unknown Source:2)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:37)
at it.beesmart.activity.Application.registerWith(Application.kt:18)
at io.flutter.plugins.geofencing.GeofencingService.startGeofencingService(GeofencingService.kt:74)
at io.flutter.plugins.geofencing.GeofencingService.onCreate(GeofencingService.kt:114)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3763)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
2020-01-03 16:37:30.937 22993-22993/it.myapp.activity E/AndroidRuntime: FATAL EXCEPTION: main
Process: it.myapp.activity, PID: 22993
java.lang.RuntimeException: Unable to create service io.flutter.plugins.geofencing.GeofencingService: java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3775)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null
at io.flutter.plugins.geofencing.GeofencingService.startGeofencingService(GeofencingService.kt:65)
at io.flutter.plugins.geofencing.GeofencingService.onCreate(GeofencingService.kt:114)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3763)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
i followed the example app exactly. Flutter version Flutter 1.12.13+hotfix.5 • https://github.com/flutter/flutter.git Framework • revision 18cd7a3601 (3 weeks ago) • 2019-12-11 06:35:39 -0800 Engine • revision 2994f7e1e6 Tools • Dart 2.7.0
For the iOS crash you haven't called GeofencingPlugin's setPluginRegistrantCallback or you've passed in a bad value.
For the Android crash, you're trying to register a plugin in the background that depends on the existence of an Android Activity
, which will always crash if there's no UI open. You'll need to manually create a class similar to GeneratedPluginRegistrant
and make it so only plugins which don't rely on a UI are registered.
How to do with swift? setPluginRegistrantCallback return 'A C function pointer can only be formed from a reference to a 'func' or a literal closure'
func registerPlugins(registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
}
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
GeofencingPlugin.setPluginRegistrantCallback(self.registerPlugins)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
GeofencingPlugin.setPluginRegistrantCallback { (registry:FlutterPluginRegistry) in
GeneratedPluginRegistrant.register(with: registry)
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
I've this error on xCode and i'm going crazy trying to access other plugins from callback.