invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.81k stars 213 forks source link

Android - Crash "Unable to instantiate receiver app.notifee.core.AlarmPermissionBroadcastReceiver" #517

Closed Minishlink closed 1 year ago

Minishlink commented 2 years ago

Hello,

Got this crash java.lang.RuntimeException: Unable to instantiate receiver app.notifee.core.AlarmPermissionBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "app.notifee.core.AlarmPermissionBroadcastReceiver" after enabling alarm in the app settings. Note that the crash doesn't happen when disabling it.

notifee 5.7.0 compileSdkVersion 31 targetSdkVersion 31 Tested on a Galaxy S10e on Android 12

mikehardy commented 2 years ago

Hi there! This is a pretty sparse bug report. Do you have the stack trace (https://stackoverflow.com/help/how-to-ask)? Any code that reproduces (https://stackoverflow.com/help/minimal-reproducible-example)

Could you post your android/bulid.gradle and android/app/build.gradle files?

Can you detali the exact steps to reproduce ?

Basically, imagine yourself as the director of software engineering, with 3 team leads, each running a crew of 4 programmers. You are pretty busy with project management tasks, customer requests, directing your team leads and then...someone comes to you with a bug report. What do you need in order to efficiently solve it?

That's what you need to bring to bug reports in order to have efficient, positive interactions.

Minishlink commented 2 years ago

Sorry I felt like there was enough info, but I should have noted that this is reproducible with a fresh app:

react-native init test
cd test
yarn add @notifee/react-native
yarn react-native run-android
pidcat com.test

Go the "test" app settings, disable the alarm permission. Go back to the "test" app, go again to the "test" app settings, enable the alarm permission, exit the app settings, and notice the error on your terminal (pidcat)

                         E  FATAL EXCEPTION: main
                         E  Process: com.test, PID: 20677
                         E  java.lang.RuntimeException: Unable to instantiate receiver app.notifee.core.AlarmPermissionBroadcastReceiver: java.lang.ClassNotFoundEx
                            ception: Didn't find class "app.notifee.core.AlarmPermissionBroadcastReceiver" on path: DexPathList[[zip file "/data/app/~~nSKtMrbCecMY
                            9Iz38AHuuw==/com.test-CXPRNX-Q14umuiB6PEK8fA==/base.apk"],nativeLibraryDirectories=[/data/app/~~nSKtMrbCecMY9Iz38AHuuw==/com.test-CXPRN
                            X-Q14umuiB6PEK8fA==/lib/arm64, /data/app/~~nSKtMrbCecMY9Iz38AHuuw==/com.test-CXPRNX-Q14umuiB6PEK8fA==/base.apk!/lib/arm64-v8a, /system/
                            lib64, /system/system_ext/lib64]]
                         E      at android.app.ActivityThread.handleReceiver(ActivityThread.java:4726)
                         E      at android.app.ActivityThread.access$1800(ActivityThread.java:310)
                         E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2292)
                         E      at android.os.Handler.dispatchMessage(Handler.java:106)
                         E      at android.os.Looper.loopOnce(Looper.java:226)
                         E      at android.os.Looper.loop(Looper.java:313)
                         E      at android.app.ActivityThread.main(ActivityThread.java:8663)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
                         E  Caused by: java.lang.ClassNotFoundException: Didn't find class "app.notifee.core.AlarmPermissionBroadcastReceiver" on path: DexPathList
                            [[zip file "/data/app/~~nSKtMrbCecMY9Iz38AHuuw==/com.test-CXPRNX-Q14umuiB6PEK8fA==/base.apk"],nativeLibraryDirectories=[/data/app/~~nSK
                            tMrbCecMY9Iz38AHuuw==/com.test-CXPRNX-Q14umuiB6PEK8fA==/lib/arm64, /data/app/~~nSKtMrbCecMY9Iz38AHuuw==/com.test-CXPRNX-Q14umuiB6PEK8fA
                            ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
                         E      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                         E      at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:110)
                         E      at androidx.core.app.CoreComponentFactory.instantiateReceiver(CoreComponentFactory.java:60)
                         E      at android.app.ActivityThread.handleReceiver(ActivityThread.java:4719)
                         E      ... 9 more
helenaford commented 1 year ago

@Minishlink thanks for the additional info. I wonder if this could be device specific 🤔 were you able to reproduce with an emulator?

NathanHynes commented 1 year ago

I am experiencing the same issue with the exact same stack trace that @Minishlink has detailed.

Using the same version of notifee as well

I have been testing on a Pixel 3a on Android 12

I can see this issue that was closed back last year which mentions crashes but I am not sure how related it is: https://github.com/invertase/notifee/issues/239

github-actions[bot] commented 1 year ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

MateuszMazurTUL commented 1 year ago

Hello,

would to reopen issue, 'cuz it still exist in this same scheme like above.

I can't provide any new information, besides testing platform.

Tensting on: Pixel 6a (android 13) Xiaomi Mi11 (android 12) Notifee version: 5.2.1 7.5.0

megabayt commented 9 months ago

I see a bunch of similar errors on Android 14 in crashlytics. notifee version - 5.2.1: e.g. recent from galaxy s23 ultra:

Fatal Exception: java.lang.RuntimeException
Unable to instantiate receiver app.notifee.core.AlarmPermissionBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "app.notifee.core.AlarmPermissionBroadcastReceiver" on path: DexPathList[[zip file "/data/app/~~Op0zTLznqkN9_IxYE2AnqA==/com.chessable.chessable-zkEAcZGDu8WkRWPWtewMtw==/base.apk"],nativeLibraryDirectories=[/data/app/~~Op0zTLznqkN9_IxYE2AnqA==/com.chessable.chessable-zkEAcZGDu8WkRWPWtewMtw==/lib/arm64, /data/app/~~Op0zTLznqkN9_IxYE2AnqA==/com.chessable.chessable-zkEAcZGDu8WkRWPWtewMtw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]