启用proguard,我的构建版本应用程序将不再安装

时间:2016-07-16 01:10:00

标签: android android-studio android-proguard

我启用了proguard缩小我的发布版apk。但我的应用程序之后不会安装。如果我得到一些如何解决它的帮助,我会很高兴。它似乎无法在我正在使用的app-theme-engine库中找到一个方法。

AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.john.music, PID: 8076
java.lang.RuntimeException: Failed to get ActionView from an ActionMenuItemView: mItemData
       at com.afollestad.appthemeengine.inflation.a.i(Unknown Source)
       at com.afollestad.appthemeengine.inflation.a.h(Unknown Source)
       at com.afollestad.appthemeengine.inflation.a.setIcon(Unknown Source)
       at android.support.v7.view.menu.ActionMenuItemView.a(Unknown Source)
       at android.support.v7.widget.k.a(Unknown Source)
       at android.support.v7.view.menu.d.a(Unknown Source)
       at android.support.v7.widget.k.a(Unknown Source)
       at android.support.v7.widget.k.a(Unknown Source)
       at android.support.v7.view.menu.i.j(Unknown Source)
       at android.support.v7.view.menu.d.a(Unknown Source)
       at android.support.v7.widget.k.a(Unknown Source)
       at android.support.v7.view.menu.i.d(Unknown Source)
       at android.support.v7.view.menu.i.a(Unknown Source)
       at android.support.v7.view.menu.i.h(Unknown Source)
       at android.support.v7.a.bj.j(Unknown Source)
       at android.support.v7.a.bk.run(Unknown Source)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
       at android.view.Choreographer.doCallbacks(Choreographer.java:590)
       at android.view.Choreographer.doFrame(Choreographer.java:559)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6117)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    Caused by: java.lang.NoSuchFieldException: mItemData
       at java.lang.Class.getDeclaredField(Class.java:929)
       at com.afollestad.appthemeengine.inflation.a.i(Unknown Source) 
       at com.afollestad.appthemeengine.inflation.a.h(Unknown Source) 
       at com.afollestad.appthemeengine.inflation.a.setIcon(Unknown Source) 
       at android.support.v7.view.menu.ActionMenuItemView.a(Unknown Source) 
       at android.support.v7.widget.k.a(Unknown Source) 
       at android.support.v7.view.menu.d.a(Unknown Source) 
       at android.support.v7.widget.k.a(Unknown Source) 
       at android.support.v7.widget.k.a(Unknown Source) 
       at android.support.v7.view.menu.i.j(Unknown Source) 
       at android.support.v7.view.menu.d.a(Unknown Source) 
       at android.support.v7.widget.k.a(Unknown Source) 
       at android.support.v7.view.menu.i.d(Unknown Source) 
       at android.support.v7.view.menu.i.a(Unknown Source) 
       at android.support.v7.view.menu.i.h(Unknown Source) 
       at android.support.v7.a.bj.j(Unknown Source) 
       at android.support.v7.a.bk.run(Unknown Source) 
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) 
       at android.view.Choreographer.doCallbacks(Choreographer.java:590) 
       at android.view.Choreographer.doFrame(Choreographer.java:559) 
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) 
       at android.os.Handler.handleCallback(Handler.java:739) 
       at android.os.Handler.dispatchMessage(Handler.java:95) 
       at android.os.Looper.loop(Looper.java:145) 
       at android.app.ActivityThread.main(ActivityThread.java:6117) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:372) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 

1 个答案:

答案 0 :(得分:0)

解决了它。我能够找到一个有效的解决方案:How to make Proguard ignore external libraries?。我把它添加到我的proguard文件中:

-keep class javax.** { *; }
-keep class org.** { *; }
-keep class com.afollestad.** { *; }

最后一个是最重要的,它是整个主题库,其中找不到某些类。