【发布时间】:2014-03-28 17:12:50
【问题描述】:
Android Studio (0.5.3) 快把我逼疯了。
我从来没有遇到过 Eclipse 和 ADT 的任何严重问题。 Android Studio 是另一回事:我无法使用它正确构建单个项目。
所以,我正在尝试导入一个 Android 示例项目(我认为它具有正确的 Gradle 设置并且应该可以导入):
C:\pathToMyAndroidSDK\sdk\samples\android-19\content\StorageProvider
我得到的第一个错误如下:
Failed to refresh Gradle project 'StorageProvider'
The project is using an unsupported version of Gradle. Please use version 1.10.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
Fix Gradle wrapper and re-import project Gradle settings
好的,所以我下载了 Gradle 1.10,并更改了项目 Gradle 设置,以便它使用这个本地 Gradle 分发而不是默认的 gradle 包装器(它似乎包含在示例项目中)。
这次我得到一个不同的错误:
Failed to refresh Gradle project 'StorageProvider'
The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Version 0.9.0 introduced incompatible changes in the build language.
Please read the migration guide to learn how to update your project.
我对 Gradle 的了解不够,无法自己迁移配置,我也不想这样做。
我怎样才能简单地使用 gradle 包装器而不被召唤使用 Gradle 1.10(与项目不兼容)? 也欢迎任何其他解决方案。
注意:我曾尝试使用 android-19 文件夹中的其他示例项目,但得到相同的错误。
编辑:
我更幸运地尝试在 Linux 下使用命令行 (gradlew build) 进行构建。
构建成功,不管我在build.gradle中设置了什么:
classpath 'com.android.tools.build:gradle:0.9.+'
或
classpath 'com.android.tools.build:gradle:0.8.+' #(the original configuration of the sample project)
所以我的问题似乎是由 Android Studio 中的错误引起的。
【问题讨论】:
标签: android android-studio gradle android-gradle-plugin build.gradle