Description:
When building a React Native app with enableProguardInReleaseBuilds true (R8/ProGuard enabled), the app crashes.
Adding some ProGuard rules (e.g., keeping com.google.gson.reflect.TypeToken) stops the crash, but push notifications stop working.
Debug builds and release builds with enableProguardInReleaseBuilds false work correctly.
This suggests that the library needs official ProGuard/R8 rules that prevent crashes while keeping push notifications functional.
Environment:
react-native-pusher-push-notifications version: 2.6.0
- React Native version:
0.81.4
- Gradle version:
8.14.3
Steps to Reproduce:
- Install and configure
react-native-pusher-push-notifications.
- Build the release APK with
enableProguardInReleaseBuilds true.
- Run the app on an Android device.
- Observe that the app crashes on startup.
- Adding ProGuard rules like `# --- Pusher Beams / Push Notifications SDK ---
-keep class com.pusher.pushnotifications.** { ; }
-keep class com.pusher.pushnotifications.api.* { ; }
-keep class com.pusher.pushnotifications.fcm.* { ; }
-keep class com.pusher.pushnotifications.internal.* { ; }
-keep class com.pusher.pushnotifications.reporting.* { *; }
--- OkHttp & Okio (used internally) ---
-keep class okhttp3.** { ; }
-keep class okio.* { *; }
--- Gson ---
-keepattributes Signature
-keepattributes Annotation
-keep class com.google.gson.** { ; }
-keep class com.google.gson.reflect.TypeToken { ; }
-keep class com.google.gson.stream. { *; }
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName ;
}
` stops the crash but push notifications no longer arrive.
Expected Behavior:
- App should not crash in release builds.
- Push notifications should work in release builds with enableProguardInReleaseBuilds enabled.
Suggested Solution:
Provide official ProGuard/R8 rules for Android, covering all necessary classes used by the library, Gson, OkHttp, and any reflection-based serialization.
Additional Context:
- Crash stack trace shows
ExceptionInInitializerError & Caused by: java.lang.RuntimeException: Missing type parameter. at t3.a.d(SourceFile:27)1 inside com.pusher.pushnotifications` classes.
- Partial ProGuard rules prevent crash but break notifications.
- README does not currently provide guidance for ProGuard/R8 rules.
Description:
When building a React Native app with
enableProguardInReleaseBuilds true(R8/ProGuard enabled), the app crashes.Adding some ProGuard rules (e.g., keeping
com.google.gson.reflect.TypeToken) stops the crash, but push notifications stop working.Debug builds and release builds with
enableProguardInReleaseBuilds falsework correctly.This suggests that the library needs official ProGuard/R8 rules that prevent crashes while keeping push notifications functional.
Environment:
react-native-pusher-push-notificationsversion:2.6.00.81.48.14.3Steps to Reproduce:
react-native-pusher-push-notifications.enableProguardInReleaseBuilds true.-keep class com.pusher.pushnotifications.** { ; }
-keep class com.pusher.pushnotifications.api.* { ; }
-keep class com.pusher.pushnotifications.fcm.* { ; }
-keep class com.pusher.pushnotifications.internal.* { ; }
-keep class com.pusher.pushnotifications.reporting.* { *; }
--- OkHttp & Okio (used internally) ---
-keep class okhttp3.** { ; }
-keep class okio.* { *; }
--- Gson ---
-keepattributes Signature
-keepattributes Annotation
-keep class com.google.gson.** { ; }
-keep class com.google.gson.reflect.TypeToken { ; }
-keep class com.google.gson.stream. { *; }
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName ;
}
` stops the crash but push notifications no longer arrive.
Expected Behavior:
Suggested Solution:
Provide official ProGuard/R8 rules for Android, covering all necessary classes used by the library, Gson, OkHttp, and any reflection-based serialization.
Additional Context:
ExceptionInInitializerError&Caused by: java.lang.RuntimeException: Missing type parameter. at t3.a.d(SourceFile:27)1 insidecom.pusher.pushnotifications` classes.