This issue typically occurs when code shrinking and obfuscation tools, like ProGuard or R8, are enabled for your release build and strip or rename classes the Pushwoosh SDK looks up by name, leading to errors such as java.lang.IllegalStateException: Could not find class for name....
First: make sure you are on a current SDK
Since Pushwoosh Android SDK 6.x, the SDK ships its own consumer ProGuard rules inside the AAR (consumerProguardFiles), and R8 applies them automatically in your app. Those rules already keep, among others:
-keep public class * extends com.pushwoosh.notification.NotificationServiceExtension { *; }
-keep public class * extends com.pushwoosh.notification.NotificationFactory { *; }
-keep public class * extends com.pushwoosh.notification.SummaryNotificationFactory { *; }
-keep class * implements com.pushwoosh.internal.Plugin { *; }
-keep class * implements com.pushwoosh.internal.PluginProvider { *; }
So if your custom NotificationServiceExtension extends the Pushwoosh base class, updating to the latest SDK usually resolves the error with no extra rules on your side.
If the error persists
Add explicit rules to your proguard-rules.pro:
-
Keep your own classes referenced from the manifest. Any class you register through
meta-data(for example a custom notification extension or factory) that does not extend a Pushwoosh base class must be kept manually. The error log names the exact class.# Replace with the full name of your class -keep class com.your.package.YourCustomNotificationExtension { *; } -
As a fallback, keep the whole SDK package (broad, but harmless):
-keep class com.pushwoosh.**{ *; } -dontwarn com.pushwoosh.**
After changing the rules, clean and rebuild the project, then reinstall the release build on the device.
Comments
0 comments
Please sign in to leave a comment.