2014-10-02 59 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

相關問題