Is there any way to integrate Eclipse with Gradle

2019-01-03 13:33发布

I have Android project with standard build.gradle (also I added android annotations).

Also I installed Gradle plugin (from http://dist.springsource.org/release/GRECLIPSE/e4.3/) to my Eclipse (Kepler) and converted project to Gradle project.

Unfortunately I cannot run Gradle build on my Eclipse (in cmd line everything works).

My question is how to make Eclipse works with Gradle just like with Maven.

4条回答
时光不老,我们不散
3楼-- · 2019-01-03 14:13
  1. Install Gradle:
    a. http://gradle.org/gradle-download/ b. Choose 2.1 from previous releases section. c. Unzip at convenient folder.(Ex : D:\Graddle\gradle-2.1) d. Set system environment variables. i. GRADLE_HOME as D:\Graddle\gradle-2.1) ii. GRADLE_OPTS as -XX:MaxPermSize=512m iii. %GRADLE_HOME%\bin to Path iv. Set ANDROID_HOME ( Ex: D:\android-sdk) v. Append “%ANDROID_HOME %\platform-tools” to path.

e. Open command prompt and check gradle is set. May use gradle -version to check.

  1. Install Gradle eclipse PlugIn: a. Launch Eclipse b. Help > Eclipse Market Place c. Search “gradle” d. In that choose “Nodeeclipse/enide” e. Select all listed, accept & install. f. Restart eclipse once installed.

  2. Set Gradle & Java Homes : a. Launch eclipse. b. Window > Preferences > Gradle EnIDE c. Set these if not set : i. Gradle home to use is set ( Ex: D:\Graddle\gradle-2.1) ii. Alternate JAVA_HOME to use is set ( Ex : C:\Program Files (x86)\Java\jdk1.7.0_60) iii. JVM options for GRADLE_OPTS is set to “-XX:MaxPermSize=512m”

  3. Build the Project: a. Expand PhoneDishAnywhere in eclipse Java explorer. b. Right click on build.gradle c. Run As > Gradle GUI d. Comand Line : gradle clean build e. Wait for build to complete : First time build will take several minutes. f. If Build dex error or Java heap space error : i. Open build.gradle in editor. ii. Set appropriate javaMaxHeapSize based on your java (javaMaxHeapSize=1024M for 32bit Java,2048M for 64bit Java) iii. May comment signing (//apply from: "$rootProject.projectDir/jenkins_config/gradle/signing.gradle";) to avoid signing for debug build. iv. Build again after these fixes.

  4. Install Build On device: a. Connect the device to m/c. b. Right click on build.gradle c. Run As > gradle installDebug Gradle Android start d. Wait for install to complete

查看更多
劳资没心,怎么记你
4楼-- · 2019-01-03 14:14

I use neon eclipse for android developer with gradle integration. Also, I use gradle plugin (com.github.ginvavilon:android-eclipse) for generating .project and .classpath for new structure of android project (src/main/java; src/main/res ...). Flavors and build types are supported. And use that project as gradle-project

查看更多
Root(大扎)
5楼-- · 2019-01-03 14:26

In order to be able to build an Android gradle project with Eclipse I followed these instructions:

  1. Install these Eclipse plugins:

    • Gradle IDE (3.4.0)
    • Android Development Tools (22.3.0)
  2. If you have an old-style android project layout, change your build.gradle to configure source directories as explained in the Android Gradle User Guide.

  3. If you have a gradle android project layout, create two symbolic links into the root of your project.

    ln -s src/main/res res
    ln -s src/main/AndroidManifest.xml AndroidManifest.xml

I hope it helps!

查看更多
登录 后发表回答