【发布时间】:2015-02-23 17:45:12
【问题描述】:
我已经开发这个 android 几天了,突然应用程序构建有很多错误并且无法运行。下面列出了前几个错误
D:\somepath\someotherpath\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\values-v11\values.xml
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
下面列出了一些可能导致这些错误的原因
我试图通过使用Intel HAXM 和Genymotion 来加速模拟器。我可以看到 build.gradle
的依赖项的变化build.gradle old
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.nirvanasoftware.donor_app"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
}
**build.gradle 新建 **
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.nirvanasoftware.donor_app"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
依赖性的变化是否会导致构建错误或其他原因。
【问题讨论】:
-
我看不出这两个版本有什么区别。为什么你认为 targetSdkVersion 和 compileSdkVersion 被“突然”改变了?
-
您是否仔细检查了 SDK 管理器并根据您安装的版本验证了这些版本号?
-
@aga 我想我需要睡觉了!我已经改变了这个问题,因为正如你指出的目标和编译版本没有改变。但是依赖有。这是我的第一个 android 项目,所以我不确定很多事情。现在,我正在尝试消除这些错误(大约 100 个)。
-
请在 build.gradle 中设置:minifyEnabled false 而不是 runProguard false
-
@IntelliJAmiya minifyEnabled false 给我以下错误“错误:(16, 0) 构建脚本错误,找到不支持的 Gradle DSL 方法:'minifyEnabled()'!可能的原因可能是:-您使用的是 Gradle方法不存在的版本(修复 Gradle 设置) - 您没有应用提供该方法的 Gradle 插件(应用 Gradle 插件) - 或者构建脚本中有错误 (Goto source)"
标签: java android android-emulator android-studio