2014-10-28 36 views
8

我想在我的一個項目中使用Material Design。但是我對appcompat-v7:21.0.0庫有着非常不好的體驗。只要我在Android Studio中添加依賴項並開始同步,就會出現以下錯誤。找不到與給定名稱相匹配的資源:attr'android:actionModeShareDrawable'appcompat -v7:21.0.0 with compileSdkVersion 21

Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. 

No resource found that matches the given name: attr 'android:overlapAnchor'. 

但我確定我正在用最新的編譯工具編譯最新的SDK 21。這是我的構建配置。

android { 
compileSdkVersion 21 
buildToolsVersion '21.0.1' 

defaultConfig { 
    minSdkVersion 15 
    targetSdkVersion 21 
    versionCode 3 
    versionName "0.0.003" 
} 
buildTypes { 
    release { 
     runProguard false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

我在這裏做的錯誤是什麼?它是否適用於其他人? 這是我的其他依賴FYI。有人經歷了這一步,請指導我。

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile files('libs/smartconfiglib.jar') 
compile 'com.android.support:support-v4:21.0.0' 
compile 'com.crashlytics.android:crashlytics:1.1.13' 
compile 'com.google.android.gms:play-services:6.1.11' 
compile 'com.jakewharton.hugo:hugo-runtime:1.1.0' 
compile 'com.squareup.retrofit:retrofit:1.7.1' 
compile 'com.android.support:appcompat-v7:21.0.0' 
compile 'com.android.support:cardview-v7:21.0.0' 
compile 'com.jakewharton:butterknife:5.1.2' 
compile 'de.greenrobot:eventbus:2.2.1' 
compile 'fr.avianey:facebook-android-api:[email protected]' 
compile('de.keyboardsurfer.android.widget:crouton:[email protected]') { 
    exclude group: 'com.google.android', module: 'support-v4' 
} 
apt 'com.turbomanage.storm:storm-impl:0.99' 
compile 'com.turbomanage.storm:storm-api:0.99' 
compile 'com.squareup.picasso:picasso:2.3.4' 
compile 'com.astuetz:pagerslidingtabstrip:1.0.1' 
compile 'com.apptentive:apptentive-android:[email protected]' 
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2' 

}

+0

你見過http://stackoverflow.com/questions/26457096/appcompat-v7-r21-returning-error-in-values-xml嗎? – 2014-10-28 13:00:17

+0

[appcompat-v7:21.0.0'可能的重複:找不到與給定名稱相匹配的資源:attr'android:actionModeShareDrawable'](http://stackoverflow.com/questions/26431676/appcompat-v721-0-0 -no-resource-found-that-matches-the-name-attr-andro) – reVerse 2014-10-28 14:37:09

+0

@shayanpourvatan該解決方案不起作用。我的問題是我已經在使用最新的構建工具(21.0.1),SDK平臺(21)。它仍然不起作用。 – Gopinath 2014-10-29 06:41:55

回答

1

我面臨同樣的問題。請檢查您的build.gradle文件,並改變從

classpath 'com.android.tools.build:gradle:0.12.+' 

的gradle這個依賴於

classpath 'com.android.tools.build:gradle:0.12.1' 

確保您的SDK更新爲21版,並在你的gradle這個compileSdkVersion

我希望這會對你有用。

2

進入您的Android SDK管理器並刪除以下SDK平臺

  • L Preview SDK Platform
  • API 21 SDK Platform

然後繼續前進,重新安裝API 21 SDK Platform

爲我修好了!請參閱details

+0

我會嘗試這個並更新答案。 – Gopinath 2014-11-26 12:27:02

相關問題