Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
proguard如何防止Android 4.3上v7.appcompat的NoClassDefFoundError?_Android_Proguard_Android Support Library - Fatal编程技术网

proguard如何防止Android 4.3上v7.appcompat的NoClassDefFoundError?

proguard如何防止Android 4.3上v7.appcompat的NoClassDefFoundError?,android,proguard,android-support-library,Android,Proguard,Android Support Library,从appcompat-v7版本20升级到21.0.3后,我的Android应用程序在运行Android 4.3的三星Galaxy Nexus上发布时开始崩溃。它在装有安卓5.0的Galaxy S5上运行良好 这是我的堆栈跟踪的顶部: java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr at android.support.v7.app.ActionBarActivityDelegateBase.e

从appcompat-v7版本20升级到21.0.3后,我的Android应用程序在运行Android 4.3的三星Galaxy Nexus上发布时开始崩溃。它在装有安卓5.0的Galaxy S5上运行良好

这是我的堆栈跟踪的顶部:

java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr
        at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:263)
        at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225)
        at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
        at com.xxx.ui.LoginChoiceActivity.onCreate(LoginChoiceActivity.java:39)
我相信这个问题已经被报道和讨论到了极点。 一些关于这个问题的评论者设法在proguard配置文件中使用各种各样的咒语来解决这个问题。所以我尝试了同样的方法并设法摆脱了崩溃,但我不明白是什么导致了修复

我正在使用Android Studio 1.1.0。我在build.gradle中添加了以下内容:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
这是我的proguard-rules.pro文件:

# Works regardless of whether this is commented out or not.
#-keep class ** {*;}

# We know these reference classes that we don't have. It's ok.
-dontwarn com.flurry.**,com.millennialmedia.**

-dontoptimize
-dontshrink
-dontobfuscate

我不喜欢我不理解的错误修复/解决方法,那么有人知道ProGuard为我做了什么吗?

在ProGuard-rules.pro文件中添加这行代码,以防止ProGuard支持V7

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

@阿普瓦,我看不出这有什么关系。