2014-10-02 60 views
0

我无法在android studio中编译项目。我得到4个错误,如下所示。包含错误在Android Studio中编译项目时出错

我的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小时now.Thanks很多,为您的帮助。

+0

你有build.gradle的依赖项部分中的appcompat库? – 2014-10-02 14:41:24

+0

@ Tanis7x我有这样的代码:依赖关系在我的build.gradle文件中编译com.android.support:appcompat-v7:20.+' }。你能提出什么可能是错的吗?谢谢。 – 2014-10-02 14:42:19

+0

看到我编辑的答案 – goonerDroid 2014-10-02 15:05:58

回答

0

您可能会丢失AppCompat库,它支持目录。 AppCompat是一个图书馆项目。您需要引用库项目在Android project.use此链接添加您的支持包您使用此parent="@style/Theme.AppCompat"改用此parent="@android:style/Theme.AppCompat"。我想他们有link to add app compat

错字的文件档案

+0

我做到了。在build.gradle中添加了依赖关系。还有更多事情要做? AppCompat需要添加到其他地方吗? – 2014-10-02 14:46:23

+0

是转到您的sdk管理器并检查是否安装了Android支持库 – goonerDroid 2014-10-02 14:47:45

+0

我已经安装了it.it。 – 2014-10-02 14:50:17

相关问题