Amplitude-ReactNative
Amplitude-ReactNative copied to clipboard
[android] App crashing in release mode as soon as we enable proguard
The build works fine in the debug mode, but as soon as we enable the proguard, we have started getting the following exception and app is crashing right away, can someone suggest the right proguard rules to avoid this issue.
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.amplitude.reactnative.AmplitudeReactNativeModule.setServerZone(Unknown Source:7)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:148)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:147)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:193)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:764)
I have tried adding below proguard rules on top of what mentioned in the documentation to avoid any obfuscation of classes which might be stopping to invoke this method
-keep class com.amplitude.** {*;}
But it does not seems to be working.
Do you have -keep class com.google.android.gms.ads.** { *; }
in your proguard rules?
Yes i have explicitly added this rule to my pro-guard rules.