2016-05-14 60 views
0

我打開現有項目,在Android Studio中2.1 Beta 2的正常工作和我有一些錯誤,當我運行該項目。Android的易編譯:[]錯誤:錯誤檢索父的項目:無資源發現在給定的名字'匹配

風格領域是:

<style name="AppBaseTheme" parent="@android:style/Theme.AppCompat.Light"> 
    <!-- 
    Theme customizations available in newer API levels can go in 
    res/values-vXX/styles.xml, while customizations related to 
    backward-compatibility can go here. 
    --> 
</style> 

<!-- Application theme. --> 
<style name="AppTheme" parent="AppBaseTheme"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
</style> 

<style name="AppBaseTheme" parent="@android:style/Theme.AppCompat.Light"> 
    <!-- API 11 theme customizations can go here. --> 
</style> 

<style name="AppBaseTheme" parent="@android:style/Theme.AppCompat.Light"> 
    <!-- API 14 theme customizations can go here. --> 
</style> 

而在AndroidManifest.xml我有喜歡本作的主題參考:

<application 
    android:theme="@style/AppTheme" > 

的錯誤是:

Error:(7, -1) android-apt-compiler: [mobile] C:\mobile\trunk\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light'.

Error:(7, -1) android-apt-compiler: [mobile] C:\mobile\trunk\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Light'.

Error:(8, -1) android-apt-compiler: [mobile] C:\mobile\trunk\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Light'.

我試着幾種方法來解決這個錯誤,但沒有成功。請幫助我一個人。

回答

0

我找到了我的錯誤的解決方案。 我已經在ProjectStructure-> Modules-> MyProjectName - > add dependencies中爲android-support-v7-appcompat添加了正確的依賴關係。 現在正常工作。

0

的風格實際上是從AppCompat支持庫,其中我認爲未來在你依賴的gradle。

嘗試用工作室升級打交道時更改主題樣式聲明

<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> 
</style> 

<!-- Application theme. --> 
<style name="AppTheme" parent="AppBaseTheme"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
</style> 

<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> 
    <!-- API 11 theme customizations can go here. --> 
</style> 

<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> 
    <!-- API 14 theme customizations can go here. --> 
</style> 

另外:

  • 運行> gradle這個>與任務clean
  • 文件運行>的Invalidate緩存/重新啓動 - >的Invalidate緩存和重新啓動
  • 使該項目

它會拋出所有舊的構建和工件,並做一個乾淨的構建,而不是增量。有時資源不同步,這解決了它。

+0

@ Derk-Jam您的解決方案仍然無法解決我的問題。錯誤是一樣的。 – ruru

+0

@ruru我在2.1 在模塊 - >'build.gradle' >>> 'compileSdkVersion 23' 'buildToolsVersion 「24rc2」'' 編譯「com.android.support:appcompat-v7:23.3。 0'' 頂層 - >'build.gradle' >>> 'classpath'com.android.tools.build:gradle:2.1.0'' –

+0

我無法創建生成文件夾,因爲我可以不運行這個項目。 – ruru

相關問題