從Android Studio安裝時,我的應用程序運行良好,但只要我安裝並將APK簽名到任何設備,應用程序就不會運行。以下是來自Google Play開發者控制檯提供的朋友設備的故障轉儲。顯然它與佈局有關,但我不確定是什麼導致它在發佈版本中,而不是在測試時。當我在我的設備上測試它時沒有錯誤顯示,並且android studio中沒有錯誤。我對開發相當陌生,所以我不知道該怎麼做。任何幫助或建議將不勝感激。應用程序從已簽名的APK崩潰,但未從安卓工作室中崩潰
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.j.a.p/com.j.a.p.MainActivity}: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.a.w.a(SourceFile:257)
at android.support.v7.a.p.setContentView(SourceFile:109)
at com.j.a.p.MainActivity.onCreate(SourceFile:31)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
... 9 more
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
... 17 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
... 22 more
Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.support.design.internal.c.a(SourceFile:97)
at android.support.design.widget.NavigationView.<init>(SourceFile:165)
at android.support.design.widget.NavigationView.<init>(SourceFile:94)
... 24 more
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
... 28 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
... 31 more
Caused by: java.lang.IllegalStateException: Binary XML file line #17: Error creating LayoutManager android.support.v7.widget.LinearLayoutManager
at android.support.v7.widget.RecyclerView.a(SourceFile:540)
at android.support.v7.widget.RecyclerView.<init>(SourceFile:485)
at android.support.design.internal.NavigationMenuView.<init>(SourceFile:39)
at android.support.design.internal.NavigationMenuView.<init>(SourceFile:35)
... 33 more
Caused by: java.lang.NoSuchMethodException: <init> []
at java.lang.Class.getConstructor(Class.java:528)
at java.lang.Class.getConstructor(Class.java:492)
at android.support.v7.widget.RecyclerView.a(SourceFile:537)
... 36 more
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet, int, int]
at java.lang.Class.getConstructor(Class.java:528)
at java.lang.Class.getConstructor(Class.java:492)
at android.support.v7.widget.RecyclerView.a(SourceFile:532)
... 36 more
你可能有proguard的組合,它與NavigationMenu視圖 –
搞亂了嘗試只是禁用proguard,並嘗試構建簽名的apk如果這樣的作品比你應該更新你的proguard文件其他問題是不同的 –