当试图在我的项目中使用最新的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,修复它。

其他回答

我的建议是:(这对我来说是有效的,经过许多天的错误)

-确保你已经下载:

- the Lastest SDK Platform from the latest Android version
- Android Suppor Librarie and Repository from EXTRAS 

重新下载ADT

-制作项目的安全副本。

-你必须将ADT,工作区和项目导入到同一个磁盘(例如C:/)

Now delete the app compat and your project. In eclipse: File > Import > Android existing project > Next > Browse (The folder where you have your ADT)/sdk/extras/android/v7/appcompat > Import > Finish Now in the eclipse Package Explorer: android-support-v7-appcompat/libs/ Make on the two JARS: Right click > Build Path > Add to Build Path Right click on libs/ folder > Buil Path > Configure Build Path and check this two JARS > OK On the upper eclipse bar > Project > Clean Import your project > File > Import > Browse your project > Finish Now, Right click on the projectfile and android-support-v7-appcompat > Properties > Android > And select the latest API that appears > OK Right click on the projectfile > Properties > Android > Add > android-support-v7-appcompat On the upper eclipse bar > Project > Clean

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

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

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

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

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

“遵循以下步骤:

这对我很有用。为了解决这个问题,

1.右键单击appcompat_v7库并选择属性

2.现在,点击Android选项, 将项目构建路径设置为Android 5.0 (API级别21) 应用更改。

3.现在进入项目。appcompat_v7库下的属性文件,

4.设置项目目标为:target=android-21

5.现在Clean + Build appcompat_v7库和你的项目

这可能是因为在构建中还没有将compileSdkVersion设置为21。gradle文件。您可能还想将targetSdkVersion更改为21。

android {
    //...
    compileSdkVersion 21

    defaultConfig {
        targetSdkVersion 21
    }
    //...
}

这要求您首先下载了最新的SDK更新。

一旦你下载了所有的更新(别忘了也更新Android支持库/存储库!),更新了你的compileSdkVersion,重新同步你的Gradle项目。

编辑:适用于Eclipse或一般IntelliJ用户

请看reVerse的回答。他走得很彻底!