Android studio Gradle构建从eclipse导入

时间:2023-01-17 13:57:44

I have a problem moving Android projects from Eclipse to Android Studio

我将Android项目从Eclipse迁移到Android Studio时遇到问题

Eclipse : 4.2.2
ADT : 22.3
Android SDK Manager : I have all the items under "Tools" installed (from rev 17 to 22.3)
Android Studio : 0.3.2
I have an automatic gradle installation in C:\Users\r0dy.gradle (where wrapper/dists shows a 1.6 and a 1.8)
I also downloaded manually a gradle 1.9 dist.

Eclipse:4.2.2 ADT:22.3 Android SDK Manager:我安装了“Tools”下的所有项目(从rev 17到22.3)Android Studio:0.3.2我在C:\ Users \ r0dy.gradle中安装了自动gradle (其中包装器/ dists显示1.6和1.8)我还手动下载了gradle 1.9 dist。

I export my project using "Generate gradle build files", runs OK.

我使用“生成gradle构建文件”导出我的项目,运行正常。

In Android Studio, if I import with default settings, it says :
You are using an old, unsupported version of Gradle. Please use version 1.8 or greater. Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)

在Android Studio中,如果我使用默认设置导入,它会说:您使用的是旧的,不受支持的Gradle版本。请使用1.8或更高版本。请在项目的Gradle设置或项目的Gradle包装器(如果适用)中指向支持的Gradle版本。

If I select "Use customizable gradle wrapper" I get :
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. Task 'wrapper' not found in root project 'CameraLibrary'.

如果我选择“使用可自定义的gradle包装器”,我得到:无法使用Gradle发行版“http://services.gradle.org/distributions/gradle-1.6-bin.zip”执行构建。在根项目'CameraLibrary'中找不到任务'包装器'。

If I select "Use local gradle distribution" and set "Gradle Home" to my dist path, I get :
Gradle version 1.6 is required. Current version is 1.9 Build file 'D:\workspaces\popfax\CameraLibrary\build.gradle' line: 9

如果我选择“使用本地gradle分发”并将“Gradle Home”设置为我的dist路径,我会得到:Gradle版本1.6是必需的。当前版本是1.9构建文件'D:\ workspaces \ popfax \ CameraLibrary \ build.gradle'行:9

I can't find a way to force Eclipse export to use my 1.9 dist or any other, and after hours of trying, I couldn't find a solution.

我找不到强制Eclipse导出使用我的1.9 dist或其他任何方法的方法,经过几个小时的尝试,我找不到解决方案。

Anyone has an idea ?

有人有想法吗?

1 个解决方案

#1


5  

Modify the relevant line in gradle/wrapper/gradle-wrapper.properties to read:

修改gradle / wrapper / gradle-wrapper.properties中的相关行以读取:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip

and import your project using default settings.

并使用默认设置导入您的项目。

#1


5  

Modify the relevant line in gradle/wrapper/gradle-wrapper.properties to read:

修改gradle / wrapper / gradle-wrapper.properties中的相关行以读取:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip

and import your project using default settings.

并使用默认设置导入您的项目。