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

It is possible to use 2 build systems (Eclipse + gradle based). Just make sure output folders are different (bin for ADT, build for gradle).
(Update for TL;DR : check Nodeclipse/Enide Gradle for Eclipse
(marketplace) )

File -> Export -> Generate Gradle build files will just add build.gradle with content below (but check versions). No existing files are changed.

com.android.tools.build:gradle version should be the latest.
For gradle type gradle build as said in http://tools.android.com/tech-docs/new-build-system/user-guide. Try gradle tasks for more. (On my slow Internet connection it took 1 hour! for gradle to download all needed dependencies)

Vogella tutorial http://www.vogella.com/articles/AndroidBuild/article.html is not yet ready. Other online tutorials are not really finished http://www.jayway.com/2013/02/26/using-gradle-for-building-android-applications/

Eclipse ADT is not yet using gradle, I think it will be polished within Android Studio first. It would be not so wise to start using evolving technology in both IDEs at the same time.

See build.gradle example below. If you already mastered gradle, then maybe Wizards is not needed at all.
For the latest build.gradle template for classic Android project check gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 8
    buildToolsVersion "19.0.0"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

ADT-Bundle does not come with Eclipse Marketplace, so update site could be used.

Update p2 repository for Gradle Integration for Eclipse is

http://dist.springsource.com/release/TOOLS/gradle

But as of version 3.4.0 it does not provide Editor for .gradle files.
So there is no sense of having it for Android development.

I would go with default ADT build, having gradle as secondary build for experimentations
and keeping an eye when flow of bugs on http://tools.android.com/tech-docs/new-build-system becomes rare. (That should be around formal 1.0 version)

UPDATE: 2014-04-15

Alex Ruiz’s (from Android team) Blog about Android, Gradle & ADT

Android’s Gradle Model

Instead of creating IDE-specific Android/Gradle models, we decided to have an IDE-agnostic representation of a Gradle project. This way, we have a single source of information that is easier to maintain. IDE integration will be implemented as a plug-in for each supported IDE (in our case, Eclipse and IDEA.) The main benefit of this approach is that we can release the Gradle plug-in independently of the IDE integration plug-ins. For example, we can ship a new version of the Eclipse plug-in that has several bug fixes, without affecting the Gradle side of Android.

As of April 2014 eclipse-gradle plugin is not compatible with android-gradle plugin:

As answered in Issue 57668 by Android team (raised by @arcone)

Project Member #2 x…@android.com

The eclipse plugin is not compatible with the android plugin.

You will not be able to import an Android gradle project into Eclipse using the default Gradle support in Eclipse.

To make it work in Eclipse we will have to change the Gradle plugin for Eclipse, the same way we are modifying the Gradle support in IntelliJ

That is Android team is working on gradle plugin for IntelliJ and gradle plugin for Eclipse needs to be updated too.

There is effort at Nodeclipse to smooth the transition times. And continue to develop in Eclipse while still experimenting or fully using gradle.

Nodeclipse/Enide Gradle for Eclipse
(marketplace)

Some screenshots for Gradle for Eclipse:

Leave a Comment