-4

I have created and released an Android app in play store but there is a weird error on it that crashes and this problem did not appear while in debug mode. The crash/bug only happens once on first-time install. Opening the app 2nd time does not have that bug/crash anymore (same for every phone). I can't test on a lot of phones but when I test on it, it crashed on Samsung phones and Oppo phones and is Android 6.0 and 7.1.

This is the error log i found in play store console

java.lang.NullPointerException: 
at android.support.v4.e.b$2.a (Unknown Source)
at android.support.v4.e.b$2.a (Unknown Source)
at android.support.v4.e.b$3.a (Unknown Source)
at android.support.v4.e.b$3.a (Unknown Source)
at android.support.v4.e.c$2$1.run (Unknown Source)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6823)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1451)

This error log doesn't point to any activity or fragments in my app and i do not know which code is producing this null pointer exception error. Can someone explain to me about this error so that I can fix the problem?

Update After reading @RoShan Shan answer, I read about the Proguard rules and found out that this might be the problem. Therefore, I implemented various rules to my app and that should fix it.

the newbie coder
  • 652
  • 2
  • 8
  • 27

1 Answers1

0

I think you enable proguard in the released version, but you forget to keep the android.support.v4. So in the proguard file, you need to add some codes like this:

-dontwarn android.support.v4.**
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

This is just some codes for android support v4 and v7, you need to do with the other class(classes about UI, ...)

You can see this link https://github.com/krschultz/android-proguard-snippets for more information to not obfuscate codes

RoShan Shan
  • 2,924
  • 1
  • 18
  • 38