[flutter/FCM]problem receiving notification - android

I'm using flutter and Firebasemessaging to send and receive notification and the plugging FlutterLocalNotifications to display them.
but when I receive the notification I get the error :
D/FLTFireMsgReceiver(23943): broadcast received for message
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:308)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:219)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1013)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1354)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1230)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at android.os.Looper.loop(Looper.java:223)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#dexterous.com/flutter/local_notifications(23943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (23943): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/flutter (23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:308)
E/flutter (23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:219)
E/flutter (23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1013)
E/flutter (23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1354)
E/flutter (23943): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1230)
E/flutter (23943): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (23943): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (23943): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/flutter (23943): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter (23943): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (23943): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (23943): at android.os.Looper.loop(Looper.java:223)
E/flutter (23943): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (23943): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (23943): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (23943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (23943): )
E/flutter (23943): #0 StandardMethodCodec.decodeEnvelope
E/flutter (23943): #1 MethodChannel._invokeMethod
E/flutter (23943): <asynchronous suspension>
E/flutter (23943): #2 FlutterLocalNotificationsPlugin.show
E/flutter (23943): <asynchronous suspension>
E/flutter (23943):

The solution is that I need to add the icon path when I set AndroidNotificationDetails.
static Future _notificationDetails() async {
return NotificationDetails(
android: AndroidNotificationDetails('channel id', 'channel name',
channelDescription: 'channel description',
importance: Importance.max,
==> icon: "#mipmap/ic_launcher"), <==
iOS: IOSNotificationDetails(),
);
}

just add icon parameter to AndroidNotificationDetails()

Related

Error flutter_local_notifications Targeting S+ (version 31 and above)

I wtitten code by flutter for mobile application
Future _showNotificationRequest() async {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'your channel id', 'your channel name', 'your channel description',
playSound: true,
importance: Importance.Max,
priority: Priority.High,
ticker: 'ticker');
var iOSPlatformChannelSpecifics =
new IOSNotificationDetails(presentSound: false);
var platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
'Новые заявки',
'Обновите список заявок',
platformChannelSpecifics,
payload: 'No_Sound',
);
}
After change SDK on version 31, because Google Play doesn`t publish my app
compileSdkVersion 31
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "kz.vashdomofon.ksu"
minSdkVersion 22
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
An error occurred while executing this method
D/CompatibilityChangeReporter(29530): Compat change id reported: 160794467; UID 10146; state: ENABLED
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loopOnce(Looper.java:161)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loopOnce(Looper.java:161)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles., null, java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/flutter (29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/flutter (29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/flutter (29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/flutter (29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (29530): at android.os.Looper.loopOnce(Looper.java:161)
E/flutter (29530): at android.os.Looper.loop(Looper.java:288)
E/flutter (29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (29530): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): )
E/flutter (29530): #0 StandardMethodCodec.decodeEnvelope
E/flutter (29530): #1 MethodChannel._invokeMethod
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #2 FlutterLocalNotificationsPlugin.show
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #3 _KSU._showNotificationRequest
E/flutter (29530): <asynchronous suspension>
E/flutter (29530):
E/flutter (29530): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles., null, java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/flutter (29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/flutter (29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/flutter (29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/flutter (29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (29530): at android.os.Looper.loopOnce(Looper.java:161)
E/flutter (29530): at android.os.Looper.loop(Looper.java:288)
E/flutter (29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (29530): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): )
E/flutter (29530): #0 StandardMethodCodec.decodeEnvelope
E/flutter (29530): #1 MethodChannel._invokeMethod
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #2 FlutterLocalNotificationsPlugin.show
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #3 _KSU._showNotificationPPR
E/flutter (29530): <asynchronous suspension>
I did not find how to fix this error, or the solutions were not suitable for my case. Can someone tell me where to look.
I tried add FLAG_MUTABLE or FALG_IMMUTABLE in MainActivity.kt, but intent out of method scope
Problem-solving by upgrading flutter, packages and gradle

Flutter: Unhandled exception: MissingPluginException - with all libraries

i got this problem with all libraries
admob flutter / native admob flutter / sharedprefrences / google mobile ads / permissions
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
W/FlutterActivityAndFragmentDelegate(21463): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Debug service listening on ws://127.0.0.1:51510/VRqSC9lk_-c=/ws
Syncing files to device sdk gphone x86 arm...
I/OpenGLRenderer(21463): Davey! duration=716ms; Flags=1, IntendedVsync=34252982492120, Vsync=34253282492108, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=34253288467940, AnimationStart=34253288528840, PerformTraversalsStart=34253288729740, DrawStart=34253322878740, SyncQueued=34253323564640, SyncStart=34253327790140, IssueDrawCommandsStart=34253327886740, SwapBuffers=34253367358840, FrameCompleted=34253703365940, DequeueBufferDuration=225435700, QueueBufferDuration=9521200, GpuCompleted=43984843964424,
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method initController on channel flutter_native_admob)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method setAdUnitID on channel [#053e2])
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method initController on channel flutter_native_admob)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method setAdUnitID on channel [#bca11])
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method initController on channel flutter_native_admob)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method setAdUnitID on channel [#716dc])
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method loadBannerAd on channel plugins.flutter.io/google_mobile_ads)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #1 BannerAd.load (package:google_mobile_ads/src/ad_containers.dart:554:5)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: plugins.flutter.io/google_mobile_ads/ad_widget
E/flutter (21463): at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:142)
E/flutter (21463): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/flutter (21463): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/flutter (21463): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (21463): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (21463): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:869)
E/flutter (21463): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (21463): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (21463): at android.os.Looper.loop(Looper.java:183)
E/flutter (21463): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (21463): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (21463): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (21463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (21463): , null, null)
E/flutter (21463): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (21463): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #2 AndroidViewController.create (package:flutter/src/services/platform_views.dart:771:5)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method loadBannerAd on channel plugins.flutter.io/google_mobile_ads)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #1 BannerAd.load (package:google_mobile_ads/src/ad_containers.dart:554:5)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: plugins.flutter.io/google_mobile_ads/ad_widget
E/flutter (21463): at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:142)
E/flutter (21463): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/flutter (21463): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/flutter (21463): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (21463): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (21463): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:869)
E/flutter (21463): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (21463): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (21463): at android.os.Looper.loop(Looper.java:183)
E/flutter (21463): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (21463): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (21463): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (21463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (21463): , null, null)
E/flutter (21463): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (21463): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #2 AndroidViewController.create (package:flutter/src/services/platform_views.dart:771:5)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
E/flutter (21463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method checkPermissionStatus on channel flutter.baseflow.com/permissions/methods)
E/flutter (21463): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #1 MethodChannelPermissionHandler.checkPermissionStatus (package:permission_handler_platform_interface/src/method_channel/method_channel_permission_handler.dart:16:20)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #2 FuturePermissionStatusGetters.isGranted (package:permission_handler_platform_interface/src/permission_status.dart:90:40)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #3 Provaiderdownload.permision (package:bac_1/Providers.dart:178:9)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463): #4 _itemPageState.downloadFile (package:bac_1/ItemPage.dart:239:9)
E/flutter (21463): <asynchronous suspension>
E/flutter (21463):
after i add this code to MainActivity.ky the sharedpreferences problem gone , but I got the same problem with all libraries
import android.content.Context
import android.os.Bundle
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(#NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
flutterEngine.getPlugins().add(SharedPreferencesPlugin())
}
}
this is my App/build.gradle file
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.bac_1"
minSdkVersion 28
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled false
shrinkResources false
useProguard true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
dependencies {
implementation 'com.android.support:multidex:1.0.3' //enter the latest version
//add them
implementation 'com.google.android.gms:play-services-ads:19.5.0'
implementation 'com.google.android.gms:play-services-basement:17.5.0'
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
}
android {
defaultConfig {
multiDexEnabled true
}
}
and this my android/build.gradle file
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
i find this solution
enter image description here
but i got this error
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
E/AndroidRuntime(22103): FATAL EXCEPTION: main
E/AndroidRuntime(22103): Process: com.example.bac_1, PID: 22103
E/AndroidRuntime(22103): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/reward/RewardedVideoAdListener;
E/AndroidRuntime(22103): at com.shatsy.admobflutter.AdmobFlutterPlugin.<clinit>(Unknown Source:0)
E/AndroidRuntime(22103): at com.shatsy.admobflutter.AdmobFlutterPlugin.registerWith(Unknown Source:0)
E/AndroidRuntime(22103): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:21)
E/AndroidRuntime(22103): at com.example.bac_1.MainActivity.configureFlutterEngine(MainActivity.kt:9)
E/AndroidRuntime(22103): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:187)
E/AndroidRuntime(22103): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:459)
E/AndroidRuntime(22103): at android.app.Activity.performCreate(Activity.java:8000)
E/AndroidRuntime(22103): at android.app.Activity.performCreate(Activity.java:7984)
E/AndroidRuntime(22103): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
E/AndroidRuntime(22103): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
E/AndroidRuntime(22103): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
E/AndroidRuntime(22103): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
E/AndroidRuntime(22103): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(22103): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(22103): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime(22103): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(22103): at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(22103): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(22103): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22103): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(22103): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime(22103): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.reward.RewardedVideoAdListener" on path: DexPathList[[zip file "/data/app/~~BBlCShaDm-m3tPK2oAlhSA==/com.example.bac_1-JIITURh6vmNBNhcQBJ3w7w==/base.apk"],nativeLibraryDirectories=[/data/app/~~BBlCShaDm-m3tPK2oAlhSA==/com.example.bac_1-JIITURh6vmNBNhcQBJ3w7w==/lib/x86, /data/app/~~BBlCShaDm-m3tPK2oAlhSA==/com.example.bac_1-JIITURh6vmNBNhcQBJ3w7w==/base.apk!/lib/x86, /system/lib, /system_ext/lib]]
E/AndroidRuntime(22103): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime(22103): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(22103): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(22103): ... 21 more
After adding library, you should stop session and run app again to successfully import plugins to your app. Plugins need to install when app is generated.

Agora exception in release mode Flutter

I am using Agora rtc in my flutter app for live streaming it works fine in debug mode
but in release I got this exception and live dose not start
log Exception when trying to open Live Stream :
E/flutter (22524): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, Incomplete hierarchy for class RtcEngineManager, unresolved classes [io.agora.rtc.base.IRtcEngine$RtcEngineInterface], null, java.lang.IllegalStateException: Incomplete hierarchy for class RtcEngineManager, unresolved classes [io.agora.rtc.base.IRtcEngine$RtcEngineInterface]
E/flutter (22524): at kotlin.reflect.jvm.internal.components.RuntimeErrorReporter.reportIncompleteHierarchy(Unknown Source:41)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassTypeConstructor.computeSupertypes(Unknown Source:211)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor$supertypes$1.invoke(Unknown Source:4)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor$supertypes$1.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(Unknown Source:86)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor.getSupertypes(Unknown Source:2)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope.getNonDeclaredVariableNames(Unknown Source:8)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$variableNamesLazy$2.invoke(Unknown Source:12)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$variableNamesLazy$2.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(Unknown Source:86)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.StorageKt.getValue(Unknown Source:10)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.getVariableNamesLazy(Unknown Source:7)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.getVariableNames(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.addFunctionsAndProperties(Unknown Source:14)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.computeDescriptors(Unknown Source:36)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope$allDescriptors$1.invoke(Unknown Source:12)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope$allDescriptors$1.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(Unknown Source:86)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope.getContributedDescriptors(Unknown Source:12)
E/flutter (22524): at kotlin.reflect.jvm.internal.impl.resolve.scopes.ResolutionScope$DefaultImpls.getContributedDescriptors$default(Unknown Source:18)
E/flutter (22524): at kotlin.reflect.jvm.internal.KDeclarationContainerImpl.getMembers(Unknown Source:17)
E/flutter (22524): at kotlin.reflect.jvm.internal.KClassImpl$Data$declaredNonStaticMembers$2.invoke(Unknown Source:10)
E/flutter (22524): at kotlin.reflect.jvm.internal.KClassImpl$Data$declaredNonStaticMembers$2.invoke(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(Unknown Source:17)
E/flutter (22524): at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(Unknown Source:0)
E/flutter (22524): at kotlin.reflect.jvm.internal.KClassImpl$Data.getDeclaredNonStaticMembers(Unknown Source:8)
E/flutter (22524): at kotlin.reflect.full.KClasses.getDe
E/flutter (22524): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, Please init RtcEngine first!,
null, java.lang.RuntimeException: Please init RtcEngine first!
E/flutter (22524): at io.agora.rtc.base.RtcSurfaceView.<init>(Unknown Source:36)

flutter crashing Attempt to invoke virtual method

I'm facing weird issue that make app crashing in production mode and it's happened once time and don't happened if I try same action I have did , so when try add item in firebase it's crashing and if return try same item in same condition maybe didn't crashed but I have cashed these issues
the first issue
/AndroidRuntime( 9758): java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference
E/AndroidRuntime( 9758): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent(CloudFirestorePlugin.java:451)
E/AndroidRuntime( 9758): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent(CloudFirestorePlugin.java:433)
E/AndroidRuntime( 9758): at com.google.firebase.firestore.Query.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore##21.3.0:1025)
E/AndroidRuntime( 9758): at com.google.firebase.firestore.Query$$Lambda$3.onEvent(Unknown Source:6)
E/AndroidRuntime( 9758): at com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore##21.3.0:42)
E/AndroidRuntime( 9758): at com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run(Unknown Source:6)
E/AndroidRuntime( 9758): at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime( 9758): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9758): at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks##17.0.2:6)
E/AndroidRuntime( 9758): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 9758): at android.app.ActivityThread.main(ActivityThread.java:7156)
E/AndroidRuntime( 9758): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9758): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime( 9758): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
I/System.out( 9758): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 9758): (HTTPLog)-Static: isSBSettingEnabled false
D/NetworkManagementSocketTagger( 9758): tagSocket(93) with statsTag=0xffffffff, statsUid=-1
D/NetworkManagementSocketTagger( 9758): tagSocket(65) with statsTag=0xffffffff, statsUid=-1
the second issue
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void j.b.a.a.n.a(java.lang.String, java.lang.Object)' on a null object reference
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a (CloudFirestorePlugin.java:106)
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a (CloudFirestorePlugin.java:2)
com.google.firebase.firestore.DocumentReference.a (DocumentReference.java:87)
com.google.firebase.firestore.DocumentReference$$Lambda$3.a (DocumentReference.java:6)
com.google.firebase.firestore.core.AsyncEventListener.a (AsyncEventListener.java:6)
com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run (AsyncEventListener.java:6)
android.os.Handler.handleCallback (Handler.java:873)
android.os.Handler.dispatchMessage (Handler.java:99)
com.google.android.gms.internal.tasks.zzb.dispatchMessage (zzb.java)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7156)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
another issue
E/flutter (24582): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.AssertionError: java.lang.NoSuchFieldException: DrawableResource
E/flutter (24582): at c.c.e.y.n.n$k0.<init>(Unknown Source:87)
E/flutter (24582): at c.c.e.y.n.n$w.a(Unknown Source:29)
E/flutter (24582): at c.c.e.f.a(Unknown Source:74)
E/flutter (24582): at c.c.e.y.n.i.a(Unknown Source:42)
E/flutter (24582): at c.c.e.y.n.i.a(Unknown Source:123)
E/flutter (24582): at c.c.e.y.n.i.a(Unknown Source:22)
E/flutter (24582): at c.c.e.f.a(Unknown Source:74)
E/flutter (24582): at c.c.e.f.a(Unknown Source:4)
E/flutter (24582): at c.c.e.f.a(Unknown Source:8)
E/flutter (24582): at c.c.e.f.a(Unknown Source:5)
E/flutter (24582): at c.c.e.f.a(Unknown Source:13)
E/flutter (24582): at com.dexterous.flutterlocalnotifications.b.b(Unknown Source:4)
E/flutter (24582): at com.dexterous.flutterlocalnotifications.b.f(Unknown Source:19)
E/flutter (24582): at com.dexterous.flutterlocalnotifications.b.onMethodCall(Unknown Source:169)
E/flutter (24582): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
E/flutter (24582): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(Unknown Source:57)
E/flutter (24582): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4)
E/flutter (24582): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (24582): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter (24582): at android.os.Looper.loop(Looper.java:181)
E/flutter (24582): at android.app.ActivityThread.main(ActivityThread.java:7156)
E/flutter (24582): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (24582): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/flutter (24582): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
E/flutter (24582): Caused by: java.lang.NoSuchFieldException: DrawableResource
E/flutter (24582): at java.lang.Class.getField(Class.java:1601)
E/flutter (24582): at c.c.e.y.n.n$k0.<init>(Unknown Source:34)
E/flutter (24582): ... 23 more
E/flutter (24582):
F/flutter (24582): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
This issue doesn't seem to happen on cloud_firestore: ^3.1.7. Try updating the cloud_firestore version that you're using. If that doesn't work, see if proguard is enabled on your Android build. Updating android.enableR8=false the Android build's gradle.properties also works to some.

Flutter app crashing on android 10 & R with No static method isAtLeastR

I've seen a few issues similar on Stack overflow, but not one that quite relates to the same libraries.
I'm trying to use 2 plugins in flutter
flutter_geofence and geolocator
They've both been working fine, but since yesterday as soon as of the location play services are called I'm getting the app quit with a stack trace similar to below:
E/flutter (11478): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoSuchMethodError: No static method isAtLeastR()Z in class Landroidx/core/os/BuildCompat; or its super classes (declaration of 'androidx.core.os.BuildCompat' appears in /data/app/com.mypossibleself.app-FTu9V5QDAKR_ngQmuPzg7Q==/base.apk!classes2.dex)
E/flutter (11478): at com.google.android.gms.common.util.PlatformVersion.isAtLeastR(com.google.android.gms:play-services-basement##17.2.1:21)
E/flutter (11478): at com.google.android.gms.common.api.GoogleApi.zaa(com.google.android.gms:play-services-base##17.2.1:128)
E/flutter (11478): at com.google.android.gms.common.api.GoogleApi.<init>(com.google.android.gms:play-services-base##17.2.1:41)
E/flutter (11478): at com.google.android.gms.common.api.GoogleApi.<init>(com.google.android.gms:play-services-base##17.2.1:56)
E/flutter (11478): at com.google.android.gms.location.FusedLocationProviderClient.<init>(Unknown Source:8)
E/flutter (11478): at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source:2)
E/flutter (11478): at com.baseflow.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.<init>(LocationUpdatesUsingLocationServicesTask.java:29)
E/flutter (11478): at com.baseflow.geolocator.tasks.TaskFactory.createStreamLocationUpdatesTask(TaskFactory.java:120)
E/flutter (11478): at com.baseflow.geolocator.GeolocatorPlugin.onListen(GeolocatorPlugin.java:110)
E/flutter (11478): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:193)
E/flutter (11478): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:172)
E/flutter (11478): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/flutter (11478): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/flutter (11478): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (11478): at android.os.MessageQueue.next(MessageQueue.java:336)
E/flutter (11478): at android.os.Looper.loop(Looper.java:174)
E/flutter (11478): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/flutter (11478): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11478): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/flutter (11478): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
So it's complaining about a missing method isAtLeastR
Other references I've seen to this mention specific versions of com.google.android.gms:play-services-base causing this, but that it's fixed in com.google.android.gms:play-services-base:17.2.1
Neither of these library implement that package in their build.gradle files so I'm at a loss as to what needs doing to fix this issue.
In the app/build.gradle add com.google.android.gms:play-services-base:17.2.1 this should make libraries use specific version of play-services.
If it doesn't help, might need to
configurations.all {
resolutionStrategy {
force 'com.google.needed_dependency'
}
}
https://flutter.dev/docs/development/packages-and-plugins/using-packages#conflict-resolution
Edit as per Andrews suggestion:
17.2.1 doesn't work, but 17.0.0 does.
implementation("com.google.android.gms:play-services-base:17.0.0"){ force = true }
resolutionStrategy {
force 'com.google.android.gms:play-services-base:17.1.0'
}
}
This is what solved it for me.

Categories

Resources