Is there any way to integrate Eclipse with Gradle in Android project?
Asked Answered
Q

4

48

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.

Quinquepartite answered 11/11, 2013 at 17:33 Comment(5)
#16746293Immodest
Long story short: Eclipse does not support Android+Gradle?Quinquepartite
No. But it's still possible to have a project that can be developed & built on both Eclipse and Android Studio/Gradle. (Easiest if you first create the project on Eclipse, use the old-style layout.)Malleus
i just imported an ansdroid studio project into eclipse. other than adding a .project file to the main directory and also to app/, it looks like there were no changes.Atropos
Has anyone tried this: gradle.org/press-release/eclipse-gradleAxle
R
24

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!

Rackety answered 24/12, 2013 at 12:0 Comment(10)
Did you intall any plugins to Eclipse?Quinquepartite
He mentioned: "Gradle IDE (3.4.0), Android Development Tools (22.3.0)"Derina
Additionally I installed Groovy/Grails ToolSuite (GGTS) plugin to have syntax highlighting for the build.gradle file.Rackety
I've been trying to get this and related projects to work for hours. Can you post a sample project somewhere?Citron
Googling for "Gradle IDE (3.4.0)" brings up the Eclipse Marketplace version, which failed to install for me. The instructions on github.com/spring-projects/eclipse-integration-gradle work.Age
how to create those two symbolic links?Bot
In linux: ln -s src/main/res res;ln -s src/main/AndroidManifest.xml AndroidManifest.xmlRackety
In Windows creating symbolic links is a little bit more complicated but they work the same like on Linux. I suggest using this tool code.google.com/p/symlinkerEdraedrea
Is there a way to specify eclipse-specific configuration in build.gradle that avoids creating the symbolic links?Pallbearer
This is not full or fake answer. Please share what are .classpath and .project values? That would show usage of plugins in the project and not the fact that Eclipse has them.Agamete
A
3

Read Is it possible to use the Gradle build system for Android with Eclipse?

try Nodeclipse/Enide Gradle for Eclipse (marketplace)

Some screenshots for Gradle for Eclipse:

Agamete answered 15/4, 2014 at 9:8 Comment(0)
I
2

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

Illative answered 7/12, 2016 at 19:23 Comment(0)
H
0
  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

Halifax answered 26/2, 2016 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.