【发布时间】:2016-01-25 03:37:53
【问题描述】:
我曾经有一个旧版本的 Android Studio(不完全确定是哪一个,它是几个月前 / 可能是去年的),一切都运行良好。它是某种 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>
再次。我的代码都没有改变,突然一切都被打破了。我还尝试过清理/构建、使缓存无效和重新启动,以及恢复到我最新的提交/重建。没有任何效果;我怎样才能解决这个问题?
【问题讨论】:
-
检查你的
compileSdkVersion 21
标签: android android-studio gradle android-gradle-plugin android-sdk-tools