【问题标题】:No resource found that matches the given name: attr 'android:actionModeShareDrawable' appcompat-v7:21.0.0 with compileSdkVersion 21找不到与给定名称匹配的资源:attr 'android:actionModeShareDrawable' appcompat-v7:21.0.0 和 compileSdkVersion 21
【发布时间】:2014-12-23 21:31:27
【问题描述】:

我正在尝试在我的一个项目中使用 Material Design。但是我对 appcompat-v7:21.0.0 库的体验非常糟糕。在 Android Studio 中添加依赖项并开始同步后,我会收到以下错误。

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'
    }
}
}

我在这里做错了什么?它对其他人有用吗? 这是我的其他依赖项仅供参考。有经历过这一步的,请指导一下。

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:+@aar'
compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
    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:1.6.+@aar'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'

}

【问题讨论】:

标签: android android-appcompat material-design


【解决方案1】:

进入您的 Android SDK 管理器并删除两个以下 SDK 平台:

  • L Preview SDK Platform
  • API 21 SDK Platform

然后继续重新安装API 21 SDK Platform

这为我解决了问题!请参阅details

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。请检查您的 build.gradle 文件并将 gradle 依赖项更改为

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

    来自

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

    确保您的 sdk 已更新到版本 21,并且在您的 gradle 中 compileSdkVersion21

    我希望这对你有用。

    【讨论】:

      猜你喜欢
      • 2014-12-13
      • 1970-01-01
      • 2015-05-19
      • 2015-01-31
      • 2017-10-13
      • 2018-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多