flutter_notification_permissions
flutter_notification_permissions copied to clipboard
Fatal Exception: java.lang.NoSuchMethodError
Firebase crash log:
Fatal Exception: java.lang.NoSuchMethodError: No static method f(Landroid/content/Context;)Landroidx/core/app/n; in class Landroidx/core/app/n; or its super classes (declaration of 'androidx.core.app.n' appears in /data/app/~~S_zz7RiRmvHW3bspwnclbg==/androidx.test.tools.crawler-6DMZwvhRTKfw6HiB15rVYA==/base.apk)
at com.vanethos.notification_permissions.MethodCallHandlerImpl.getNotificationPermissionStatus(MethodCallHandlerImpl.java:2)
at com.vanethos.notification_permissions.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:10)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:17)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:18)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:20)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java)
at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(-.java:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:10)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:7)
at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:16)
at androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:3)
at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform(ViewInteraction.java)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:6)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
obfuscation issue?
I'm also getting this, I'm running integration tests via Firebase Test Lab and all devices are triggering this exception, all different manufacturers - Google, Samsung, Huawei, etc. It happens on all Android versions I tested (8 to 12). Although, it doesn't appear to fully crash the app.
EDIT: Actually, it's not my Test Lab tests. It's caused by the automated checks run automatically by Google Play when you upload a release.
Unfortunately, the proguard rule did not help either.
-keep class com.vanethos.notification_permissions.** { *; }
Does anyone have an idea?
@offline-first Are you able to reproduce this on an actual device? What device/android version/flutter version are you using? And does it actually crash or just appear in Crashlytics?
I can't reproduce on my device or an emulator, I only see it when triggered by Google Play's pre-release checks.
I believe I have resolved this. It is a ProGuard issue, but it's not a class in this package which can't be found but the NotificationManagerCompat
class, called on line 73. I added the following to my ProGuard file:
-keep, includedescriptorclasses class androidx.core.app.NotificationManagerCompat { *; }
@Vanethos I'm not sure if this is a general issue or if both of us are doing something unusual, but would this be worth adding a note to the README? I'm happy to make a PR.
Incidentally, after fixing this I had a similiar issue in a different package (flutter_local_notifications
) which couldn't find a static method on AlarmManagerCompat
. Not quite sure why this is suddenly happenning, I don't think I'm doing anything different to other people.
No, I can't reproduce on my test devices. Just deploy to internal testing and wait a minute. Crashlytics show this error on the latest release version:
No static method f(Landroid/content/Context;)Landroidx/core/app/n; in class Landroidx/core/app/n; or its super classes (declaration of 'androidx.core.app.n' appears in /data/app/androidx.test.tools.crawler-IVtyR81jDnCTtKgIoHUHkA==/base.apk)
My last try with this proguard rule have also no effect:
-keep class androidx.core.app.** { *; }
-keep interface androidx.core.app.** { *; }