Android Studio 的 Gradle 构建错误 [英] Gradle build errors with Android Studio

查看:42
本文介绍了Android Studio 的 Gradle 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 Android Studio 中构建我的项目时,使用随下载提供的 gradle 插件 (v 1.6) 出现以下错误:

When I try to build my project in Android Studio I get the following error, using the gradle plugin provided with the download (v 1.6):

此工具 API 版本(1.6,协议版本 4)不支持指定的 Gradle 安装

当我降级到 gradle 1.3、1.4 或 1.5 时,出现此错误:

When I downgrade to gradle 1.3, 1.4 or 1.5, I get this error:

Gradle: : java.lang.ClassNotFoundException: org.gradle.tooling.provider.model.ToolingModelBuilderRegistry

该项目最初是在Eclipse中创建的,使用build gradle file选项导出,然后导入Android Studio.

The project was originally created in Eclipse, the exported using the build gradle file option, then imported into Android Studio.

有谁知道我可以做些什么来解决这些问题?非常感谢.

Does anyone know what I can do to fix these issues? Many thanks.

推荐答案

我认为问题在于 Eclipse 22 导出项目的方式.最后,我转移项目的方式是在 Android Studio 中创建一个新项目,然后将 Eclipse 项目中的文件复制到新项目中的相应目录中.

I think the problem is with the way Eclipse 22 exports the project. In the end the way I got my project transferred over was to create a new project in Android Studio and copy over the files from my Eclipse project into the appropriate directories in the new project.

Android Studio 中项目的目录结构与 Eclipse 中的结构有很大不同,启动新项目时会创建几个文件,而这些文件是从 Eclipse 导入项目时没有的(例如 gradlew.bat、settings.gradle).

The directory structure of projects in Android Studio is very different to the structure in Eclipse, and there are several files created when you start a new project which you don't get when importing a project from Eclipse (e.g. gradlew.bat, settings.gradle).

这篇关于Android Studio 的 Gradle 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆