0

我正在使用最新版本的appcompat。這是我的依賴關係:我應該在依賴關係中使用什麼版本的appcompat?

dependencies { 
    compile 'com.android.support:appcompat-v7:23.0.0' 
    compile 'com.android.support:recyclerview-v7:21.0.0' 
} 

當我重建項目中,我得到了這些錯誤:

F:\AndroidStudioProjects\recycleView\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v17\values-v17.xml 
    Error:(6, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
    Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
    Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'...........it goes for about 50 more lines 
    F:\AndroidStudioProjects\recycleView\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml 
    Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. 
    Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. 

問題是什麼?我該如何解決它?

編輯: 新的依賴(recyclerview-v7:23.0.0')和錯誤與它一起:

F:\AndroidStudioProjects\recycleView\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v17\values-v17.xml 
    Error:(6, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
    Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
    Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
    Error:(13, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
    Error:(17, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'. 
    Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
    Error:(23, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. 
    Error:(26, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. 
..... 
    Error:(122, 21) No resource found that matches the given name: attr 'android:colorPrimary'. 
    Error:(123, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. 
    F:\AndroidStudioProjects\recycleView\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml 
    Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. 
    Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. 

這些錯誤是當我使用了新的依賴

回答

0

您應該使用相同版本的程序兼容性爲RecyclerView。所以,

dependencies { 
    compile 'com.android.support:appcompat-v7:23.0.0' 
    compile 'com.android.support:recyclerview-v7:23.0.0' 
} 

會工作。

+0

感謝您的答覆,但現在我得到這個錯誤:F:\ AndroidStudioProjects \ recycleView \程序\編譯\ \中間體爆炸-AAR \ com.android.support \程序兼容性-V7 \ 23.0.0 \水庫\值-v21 \ values-v21.xml – navidjons

+0

@navidjons請更新您的文章並顯示更詳細的錯誤日誌。 – hata

+0

感謝您的回覆,我做到了 – navidjons

0

試試這個;

compile 'com.android.support:appcompat-v7:22.0.0' 
compile 'com.android.support:recyclerview-v7:22.0.0' 

我不知道是否有V7:23+可供recyclerview

+0

recyclerview-v7:23是最新版本的最新版本。 –

4

你應該總是使用支持庫與同級。

例如,使用最新版本是一個好主意。目前

dependencies { 
    compile 'com.android.support:appcompat-v7:23.0.0' 
    compile 'com.android.support:recyclerview-v7:23.0.0' 
} 

如果您使用的是支持庫V23,你有API23編譯您的項目。

在您的build.gradle更改compileSdkVersion爲。

compileSdkVersion 23 
相關問題