当试图在我的项目中使用最新的appcompat-v7支持库时,我得到以下错误:

/Users/greg/dev/mobile/android_project/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/values-v11/values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.

我怎么解决这个问题?


当前回答

在eclipse的工作区中创建第二个项目后,我遇到了这个问题。我相信这是因为我用不同的SDK版本创建了它,这覆盖了android-support-v7-appcompat库。

我试图把一切都清理干净,但无济于事。最后,对编辑项目提出以上建议。属性和更改目标= Android -21,并将我的项目设置为Android 5.0,修复它。

其他回答

在eclipse的工作区中创建第二个项目后,我遇到了这个问题。我相信这是因为我用不同的SDK版本创建了它,这覆盖了android-support-v7-appcompat库。

我试图把一切都清理干净,但无济于事。最后,对编辑项目提出以上建议。属性和更改目标= Android -21,并将我的项目设置为Android 5.0,修复它。

升级到最新的gradle插件解决了我的问题:

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

确保在android studio(或eclipse)中清理项目,

它应该能解决你的问题

在Android Studio中,我试图设置compileSdkVersion和targetSdkVersion为19。

我的解决方案是在构建的底部进行替换。Gradle,从这里:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

旧版本的appcompat库:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
}

如果你不想使用API 21作为目标API,因此你不想使用材质主题,你必须使用属于API 19 >的旧版本

compile "com.android.support:appcompat-v7:19.0.+"

这也有助于解决你的问题,这只取决于你想要实现什么。