I've added an expansion file to my app that has been working fine until recently. Whenever any file in the expansion file is opened, the app crashes with a NullPointerException. However, this only happens when the app is downloaded from the Play Store or an APK outside of Eclipse. When the app is run from Eclipse there is no such problem and all the files in the expansion work fine. My stack trace is slightly unhelpful because it tells me the problem is from an unknown source.
11-29 16:23:29.477: E/AndroidRuntime(3839): FATAL EXCEPTION: main
11-29 16:23:29.477: E/AndroidRuntime(3839): Process: net.multieducator.telaviv, PID: 3839
11-29 16:23:29.477: E/AndroidRuntime(3839): java.lang.NullPointerException
11-29 16:23:29.477: E/AndroidRuntime(3839): at net.multieducator.telaviv.be.onCreateView(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.Fragment.performCreateView(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.BackStackRecord.run(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.support.v4.app.FragmentManagerImpl$1.run(Unknown Source)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.os.Handler.handleCallback(Handler.java:733)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.os.Handler.dispatchMessage(Handler.java:95)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.os.Looper.loop(Looper.java:136)
11-29 16:23:29.477: E/AndroidRuntime(3839): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-29 16:23:29.477: E/AndroidRuntime(3839): at java.lang.reflect.Method.invokeNative(Native Method)
11-29 16:23:29.477: E/AndroidRuntime(3839): at java.lang.reflect.Method.invoke(Method.java:515)
11-29 16:23:29.477: E/AndroidRuntime(3839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-29 16:23:29.477: E/AndroidRuntime(3839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-29 16:23:29.477: E/AndroidRuntime(3839): at dalvik.system.NativeStart.main(Native Method)
Thanks for any help :)
You don't say whether you are using ProGuard in the release build but the difference in stability is consistent with issues I've had with it.
If your expansion file references classes in the main project, ProGuard's
minifyenabled
option may have obfuscated their names. If those names don't match up with the expansion file's expectations, aNullPointerException
could occur.Things to try:
minifyenabled
tofalse
and build again-keep class <your classes' package name>.** { *; }
to theproguard-rules.pro
file so that ProGuard will not obfuscate the class and member names in that package.build.gradle
file copyrelease
(underbuildTypes
) and call itdebug
.