【发布时间】:2014-11-27 14:00:50
【问题描述】:
我无法在 android studio 中编译项目。出现如下所示的 4 个错误。
我的包含错误的 xml 文件是:
<style name="Theme.Bootstrap.Dark" parent="@style/Theme.AppCompat">
<item name="android:windowBackground">@color/pager_background</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>
<style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="background">@drawable/actionbar_background</item>
<item name="android:background">@drawable/actionbar_background</item>
</style>
错误是:
Error:(5, -1) android-apt-compiler: [main] D:\android\tinynote\app\src\main\res\values\theme.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat'.
Error:(7, -1) android-apt-compiler: [main] D:\android\tinynote\app\src\main\res\values\theme.xml:7: error: Error: No resource found that matches the given name: attr 'actionBarStyle'.
Error:(11, -1) android-apt-compiler: [main] D:\android\tinynote\app\src\main\res\values\theme.xml:11: error: Error retrieving parent for item: No resource found that matches the given name '@style/Widget.AppCompat.ActionBar.Solid'.
Error:(12, -1) android-apt-compiler: [main] D:\android\tinynote\app\src\main\res\values\theme.xml:12: error: Error: No resource found that matches the given name: attr 'background'.
我需要修改一个基于 IntelliJ 构建的项目。我已经在 Android-Studio 中导入了它,但我无法编译它。之前构建的项目运行良好。 请通过提供一些分步解决方案来提供帮助。我现在被困在这 4 小时了。非常感谢您的帮助。
【问题讨论】:
-
你的 build.gradle 的依赖部分有 appcompat 库吗?
-
@Tanis7x 我的 build.gradle 文件中有此代码:dependencies { compile 'com.android.support:appcompat-v7:20.+' }。你能提出什么问题吗?谢谢。
-
查看我编辑的答案
-
@GabrieleMariotti 对不起,先生,没有什么对我有用。一个简单的错误已经破坏了我的项目。
-
您是否在模块内部使用 build.gradle(不是顶级文件)?尝试清理,清理缓存并重建prj
标签: android xml intellij-idea android-studio android-gradle-plugin