Android-Studio 从 0.1.9 升级到 0.2.0,现在导致 gradle 构建错误

问题描述:

我目前的项目一直在用 Gradle 构建就好了,因为我在获得 Android-Studio 后创建了它(大约一个月前).[我为 Android-Studio 安装了一些较早的更新,但没有那些问题.]

My current project had been building with Gradle just fine, since I created it (about a month ago), after acquiring Android-Studio. [I installed some earlier updates to Android-Studio, and had no problems with those.]

但是,今天,在我将 Android-Studio 的最新更新升级到7 月 11 日"构建,从版本 0.1.9 到 0.2.0,我的项目开始抱怨 Gradle 现在需要在最小值为 0.5.0.(我的项目要求 Gradle 0.4,而这个新的 Studio 升级标记了我的 Gradle 版本并声明它会现在需要这个新的更高的 Gradle 最低要求.

But, today, after I upgraded Android-Studio's newest update to a "July 11th" build, going from version 0.1.9 to 0.2.0, my project started complaining that Gradle now needs to be at minimum of 0.5.0. (My project was asking for Gradle 0.4, and this new Studio upgrade flagged my Gradle build and stated it would NOW need this new higher minimum of Gradle.

所以,我不清楚的是:我一直假设 Gradle 是(捆绑)Android Studio.

So, what I'm unclear about: I've been assuming Gradle is PART of (bundled with) Android Studio.

我现在是否需要获取更新的 Gradle,作为单独的产品/更新?

Do I now need to get a newer Gradle, as a separate product/update?

我很困惑!!!

(这是在 Windows-7 下发生的).

(This is happening under Windows-7).

无需重新安装或创建新项目的解决方案:

步骤 1:build.gradle 中的行从:

dependencies {
    classpath 'com.android.tools.build:gradle:0.4'
}

dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
}

注意:对于较新版本的 gradle,您可能需要将其更改为 0.6.+.

Note: for newer versions of gradle you may need to change it to 0.6.+ instead.

第 2 步:.iml 文件中,删除整个[...]</component> 标签.

Step 2: In the <YourProject>.iml file, delete the entire<component name="FacetManager">[...]</component> tag.

第 3 步 (可能不需要):在 Android SDK 管理器中,在 Extras 下安装(如果尚未安装)Android Support Repository.

Step 3 (Maybe not necessary): In the Android SDK manager, install (if not already installed) Android Support Repository under Extras.

信息在此处