我以前有一个旧版本的Android (不太确定是哪个版本的,是几个月前的/可能是去年的),一切都很好。是某种RC版本,也许是RC-2?
不管怎么说,上周我更新了最新版本v1.4,现在gradle和其他所有东西都坏了。代码没有改变。
这是我以前的gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}此文件提供错误"You must use a newer version of the Android Gradle plugin. The minimum supported version is 1.0.0 and the recommended version is 1.3.0".。
因此,当我将gradle更改为1.3.0 (或1.0.0)时,该错误将消失,但将被101个错误替换,这些错误都如下所示:
错误:(2)错误检索项的父级:没有找到与给定名称'android:Widget.Material.Spinner.Underlined‘匹配的资源。
例如,上面的错误引用了一个名为ldltr-v21/values ldltr-v21.xml的Android文件,这个文件根本不在我的项目中。这是一个包含内容的标准Android文件:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-supportlib-release/frameworks/support/v7/appcompat/res/values-ldltr-v21/styles_base.xml -->
<eat-comment/>
<style name="Base.Widget.AppCompat.Spinner.Underlined" parent="android:Widget.Material.Spinner.Underlined"/>
</resources>再来一次。我的代码都没有改变,突然之间所有的东西都坏了。我还尝试过清理/构建、使缓存无效并重新启动,并恢复到最近的提交/重建。什么都没起作用,我怎么解决这个问题呢?
发布于 2015-10-26 11:43:12
更新build.gradle文件。
使用最后一个稳定插件: 1.3.1
classpath 'com.android.tools.build:gradle:1.3.1'更新分级版本,更改gradle/wrapper/gradle-wrapper.properties文件
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip然后检查您的依赖项:
AppCompat构建的主题需要具有相同级别的API来编译应用程序.
这意味着
//You have to use compileSdkVersion=23
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:appcompat-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.0'https://stackoverflow.com/questions/33338954
复制相似问题