第一種方案:
styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下錯誤,這是版本問題。
error: Error retrieving parent for item: No resource found that matches the given name
'Theme.AppCompat.Light'.
解決方法:
在Eclipse中打開任意一個.java文件,輸入將
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
改為
<style name="AppBaseTheme" parent="android:Theme.Light">同理,將<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">改為<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">第二種方案: 如果在剛夠構建Android Studio項目的時候,運行發現,出現沒找到資源的錯誤!找不到com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml
[html] view plain copy/路徑/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. 這是API 23(Android 6.0)中的資源文件,而查看build.gradle,編譯的SDK只是為21,我們可以嘗試將compileSdkVersion設為23(如果sdk里面沒有下載API 23的,則需要下載),問題解決!如果不想下載API 23怎么解決呢?降低appcompat的版本:將build.gradle里面的dependencies對應的appcompat版本降低:
將compile 'com.android.support:appcompat-v7:23.0.1'的版本改為:'com.android.support:appcompat-v7:22.2.1'
如果想了解更多:http://stackoverflow.com/questions/32092511/resource-error-in-android-studio-after-update-no-resource-found
新聞熱點
疑難解答