2016-05-14 34 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

相关问题