Reputation: 819
I'm using OneSignal SDK for notifications with Xamarin Forms - when I run the app in Debug mode, the notifications arrive on the device.
However, when compiling and running in Release mode, no notifications appear on the device (Android One).
I suspect maybe something is being stripped out (by the compiler / linker?) - but I'm not sure how to resolve this.
The app runs in Release mode, however, in some cases seems to crash and the logs indicate the following:
java.lang.ClassNotFoundException: Didn't find class "com.onesignal.GcmBroadcastReceiver" on path: DexPathList.......
androidx.core.app.CoreComponentFactory.instantiateReceiver
java.lang.InstantiationException: java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdReceiver> cannot be instantiated
androidx.core.app.CoreComponentFactory.instantiateService
java.lang.InstantiationException: java.lang.Class<com.onesignal.RestoreKickoffJobService> cannot be instantiated
Upvotes: 0
Views: 401
Reputation: 819
For others that may be seeing the same issue this is what fixed it for me:
Create an empty file in the Android project proguard.cfg. Set the build action to ProguardConfiguration
Add the following
-keep class com.onesignal.** { *; }
-keep class com.google.firebase.** { *; }
Re-build and redeploy.
Upvotes: 0
Reputation: 9990
This type of message is caused by ProGuard / R8. You can disable it or you can add specific rules to the Proguard.cfg file to prevent code from being stripped out.
Upvotes: 1