简体   繁体   中英

App crashes after installing app from Google Play Store

So I just uploaded my app to the Google Play Store (in Alpha) for the first time.

But when I install and open the app, it crashes. Yet it works fine if I simply run it through Android Studio.

This is the error that Firebase Crash Reporting says that causes the crash:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
android.support.design.widget.CoordinatorLayout.onLayout (CoordinatorLayout.java)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.support.v4.widget.DrawerLayout.onLayout (DrawerLayout.java)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
android.widget.FrameLayout.onLayout (FrameLayout.java:261)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1741)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1585)
android.widget.LinearLayout.onLayout (LinearLayout.java:1494)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
android.widget.FrameLayout.onLayout (FrameLayout.java:261)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1741)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1585)
android.widget.LinearLayout.onLayout (LinearLayout.java:1494)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
android.widget.FrameLayout.onLayout (FrameLayout.java:261)
com.android.internal.policy.DecorView.onLayout (DecorView.java:818)
android.view.View.layout (View.java:18793)
android.view.ViewGroup.layout (ViewGroup.java:5952)
android.view.ViewRootImpl.performLayout (ViewRootImpl.java:2625)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2341)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1493)

What could be causing this error? How can I deduce what the problem is when none of my classes are listed in this error?

Found the solution:

I'm using Retrofit, along with some POJO model classes. I needed to add the following line to the proguard-rules.pro file:

-keep class package.to.models.** { *; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM