React-native-firebase: Proguard rules in v6

Created on 10 Jun 2020  路  9Comments  路  Source: invertase/react-native-firebase

Documentation Feedback

Hi
I had the v5 and there was a section which suggests if I'm using Proguard, i should add some rules (link).
But I can't see this in v6 docs! Should I create a PR for that or it's ok to not add those rules in v6 anymore :thinking: ?

Android Stale >= 6

Most helpful comment

Good question. I did a quick look around node_modules/@react-native-firebase and I don't see any proguard files or use of the string "proguard"

It may no longer be required

I still have this though in my proguard-rules.pro so I can't confirm it will work without them:

# react-native-firebase section
-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**
# end react-native-firebase section

I do see one application of the '@Keep' annotation which would do the same:

app/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java:@Keep

Could be it's not required? @Salakar do we still need any proguard stuff?

All 9 comments

Good question. I did a quick look around node_modules/@react-native-firebase and I don't see any proguard files or use of the string "proguard"

It may no longer be required

I still have this though in my proguard-rules.pro so I can't confirm it will work without them:

# react-native-firebase section
-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**
# end react-native-firebase section

I do see one application of the '@Keep' annotation which would do the same:

app/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java:@Keep

Could be it's not required? @Salakar do we still need any proguard stuff?

I want to make a release 馃槄
Any idea...?

I have already made releases, the information in my comment above is still my "state of the art", it's literally what is in my release, which is actually working.

I tried this proguard configuration but it did not work for me =/, in Debug mode I receive push in all cases, but when I generate a release version I stop receiving on Foreground on Android with data only payload and receives push on background with notification + data payload. Any idea how to debug what might be causing it in release version?
I have multiDexEnabled true on android/app/build.gradle and the proguard have these rules:

# Add any project specific keep options here:
-keep public class com.dylanvann.fastimage.* {*;}
-keep public class com.dylanvann.fastimage.** {*;}
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

# react-native-firebase section
-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**
# end react-native-firebase section

All I can offer is that if it is a proguard problem, an unfiltered logcat will show a ClassNotFoundException or NoClassDefError - they stick out wonderfully and indicate R8 shrunk something out while minimizing

I do not have this problem though so I'm surprised, although perhaps R8 "saw" I was using the classes from some other path and kept them for me, project-specifc style.

One thought - if the classes were missing, wouldn't all cases fail :thinking:

Never mind 馃き , I forgot the fact that I need a Notifee license in order to generate a release build. Soon I will have it, and I will try again. The weird thing is that on iOS I was able to receive notification with notification + data payload even without license, but not on Android 馃

2020-06-18 23:11:51.678 4664-4664/? D/RNFirebaseMsgReceiver: broadcast received for message
2020-06-18 23:11:51.773 4664-4735/? W/NOTIFEE: (License): Attempted to call method displayNotification but your license is invalid.

Interesting - I can see how that would be confusing as a platform difference. It's my understanding that licensing for notifee is still one of the areas seeing active development, with android receiving attention first as the (by far) majority platform - if that helps explain things tangentially

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 the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings