首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android-apt编译器:[]错误:错误检索项的父级:没有找到与给定名称“”匹配的资源

Android-apt编译器:[]错误:错误检索项的父级:没有找到与给定名称“”匹配的资源
EN

Stack Overflow用户
提问于 2016-05-14 14:19:39
回答 2查看 2.2K关注 0票数 0

我打开了一个在AndroidStudio2.1Beta 2中运行良好的现有项目,运行该项目时出现了一些错误。

样式字段是:

代码语言:javascript
复制
<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中,我引用了这样的主题:

代码语言:javascript
复制
 <application
  android:theme="@style/AppTheme" >

这些错误是:

错误:(7,-1) android-apt编译器: mobile C:\mobile\trunk\res\values\styles.xml:7: error: Error检索项的父级:没有找到与给定名称'@android:style/Theme.AppCompat.Light‘匹配的资源。 错误:(7,-1) android-apt编译器: mobile:\mobile\躯干\res\values v11\styes.xml:7:错误:错误检索项的父级:没有找到与给定名称'@style/Theme.AppCompat.Light‘匹配的资源。 错误:(8,-1) android-apt编译器: mobile:\mobile\躯干\res\values v14\styes.xml:8:错误:错误检索项目的父级:没有找到与给定名称'@style/Theme.AppCompat.Light‘匹配的资源。

我尝试了几种方法来解决这个错误,但没有成功。请帮帮我。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-05-16 12:19:33

我为我的错误找到了解决办法。我在ProjectStructure->Modules->MyProjectName ->add依赖项中添加了android-support-v7-appcompat的正确依赖项。现在好好工作。

票数 0
EN

Stack Overflow用户

发布于 2016-05-14 16:08:13

这些样式实际上来自于AppCompat支持库,我假设它在您的gradle依赖项中。

尝试将主题样式声明更改为

代码语言:javascript
复制
<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>

此外,在处理演播室升级时:

  • 使用任务clean运行> gradle >运行
  • 文件>失效缓存/重新启动->使缓存无效并重新启动
  • 做这个项目

它将丢弃所有的旧构建和工件,并做一个干净的构建,而不是增量。有时资源不同步,这就解决了问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37227771

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档