1
從appcompat-v7版本20升級到21.0.3後,我的Android應用程序在運行Android 4.3的三星Galaxy Nexus上啓動時崩潰。 (它可以在安卓5.0的Galaxy S5上正常運行)。proguard在Android 4.3上如何防止我的NoClassDefFoundError for v7.appcompat?
這裏是我的堆棧跟蹤的頂部:
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)
我相信這個問題被報告,並討論了彈盡糧絕here。 在這個問題上的幾位評論者設法在他們的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
我不開心的bug修正/解決方法,我不明白,那麼任何人都知道ProGuard正在爲我做什麼?
http://stackoverflow.com/questions/24096416/error-in-eclipse-with -appcompat-v7/24096452#24096452 – Apurva 2015-03-13 15:11:45
@apurva我看不出有什麼相關的。 – 2015-03-13 15:15:19