2014-10-28 38 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

相关问题