1. 程式人生 > >Android Studio:Error retrieving parent for item...

Android Studio:Error retrieving parent for item...

今天在專案中匯入compile ‘com.google.android.gms:play-services:+’時,編譯時出現了以下錯誤:

D:\MyApp\MyApplication\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34
) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(34) Error retrieving parent for
item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. D:\download\as_code\MyApplication\musicShop\build\intermediates\res\merged\debug\values-v24\values-v24.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4
) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:Execution failed for task ':musicShop:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

上網查了好久,我最終的解決方案是:
開啟build.gradle檔案,修改compileSdkVersiontargetSdkVersion為24,重新編譯即可!