2017-02-17 33 views
0

日安傢伙,錯誤:(4,42)無資源發現在給定的名字相匹配(在「cardBackgroundColor」,值爲「機器人:ATTR/colorBackgroundFloating」)

可我知道爲什麼我的回收站cardview消息日誌顯示此錯誤? 有沒有人遇到過這個錯誤?

D:\New folder\DrawerWithSwipeTabs\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml 

Error:(4, 42) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating'). 

Error:(4, 42) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating'). 

它會自動彈出到d:\新建文件夾\ DrawerWithSwipeTabs \程序\建立\中間體\水庫\合併\調試\值-V23 \價值觀v23.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="CardView" parent="Base.CardView"> 
     <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item> 
    </style> 
</resources> 

構建.gradle(項目)

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.2' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

的build.gradle(模塊:APP)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     applicationId "com.androidbelieve.drawerwithswipetabs" 
     minSdkVersion 15 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:22.2.1' 
    compile 'com.android.support:design:22.2.1' 
    compile 'com.android.support:recyclerview-v7:25.1.1' 
    compile 'com.android.support:support-v4:25.1.1' 
    compile 'com.android.support:cardview-v7:25.1.1' 

} 

回答

0
parent="Base.CardView" 

這種父類不是在SDK版本22. 介紹爲了實現這一點,你需要改變你的minSdk版本和庫版本,SDK版本23.

財產以後這樣的。

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.1" 

defaultConfig { 
    applicationId "com.androidbelieve.drawerwithswipetabs" 
    minSdkVersion 15 
    targetSdkVersion 23 
} 

buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 
} 

dependencies { 

compile 'com.android.support:appcompat-v7:23.2.1' 
compile 'com.android.support:design:23.2.1' 
compile 'com.android.support:recyclerview-v7:23.2.1' 
compile 'com.android.support:support-v4:23.2.1' 
compile 'com.android.support:cardview-v7:23.2.1' 
} 
相關問題