6

I was trying to find out how to build Android application with Gradle. To my surprise I found two references, one from jvoegele and another from Android Tools Project site. They appear to be different prima facie. So my question is why there are two variants? Is there any relation between the two? What are their current status? Which one I should use - their pros and cons? It seems the Android one is just started.

I am looking forward to some valuable inputs from guys who have first hand experience in building Android application with Gradle.

Thanks and regards

Santanu

Santanu
  • 113
  • 7
  • I am eagerly waiting to get some feedbacks. Which Gradle plugin people generally use to build Android projects? Thanks in advance. – Santanu Nov 22 '12 at 13:27

3 Answers3

1

I just playing around with the gradle plugin from the android tools project site and it feels quite hard to figure out how things should work. It is not very good integrated into the eclipse development work flow, even default project configuration for eclipse did not work for me. It is possible to fix this by extending the project and classpath file creation and modifying the project layout inside the gradle build file.

For fixing the eclipse project creation I got inspired by the plugin from jvoegele (credits go there):

eclipse{
    project {
        natures "com.android.ide.eclipse.adt.AndroidNature"

        def builders = new LinkedList(buildCommands)
        builders.addFirst(new BuildCommand("com.android.ide.eclipse.adt.PreCompilerBuilder"))
        builders.addFirst(new BuildCommand("com.android.ide.eclipse.adt.ResourceManagerBuilder"))
        builders.addLast(new BuildCommand("com.android.ide.eclipse.adt.ApkBuilder"))
        buildCommands = new ArrayList(builders)
    }
    classpath {
        containers.removeAll { it == "org.eclipse.jdt.launching.JRE_CONTAINER" }
        containers "com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"

        plusConfigurations += configurations.compile

        file {
            whenMerged { classpath ->
                classpath.entries.removeAll { it instanceof SourceFolder && (it.dir?.path == "gen" || it.dir?.path == "src") }
                classpath.entries.add(new SourceFolder("gen", null))
                classpath.entries.add(new SourceFolder("src", null))
            }
        }
    }
}

If you want to get your project fast to be productive, this is plugin not suitable for you.

0x0me
  • 754
  • 6
  • 16
  • Thanks for your feedback 0x0me!! The Android tools project also appeared to me as "work in progress". I don't want to integrate with Eclipse, I just want a command-line build system for my Android projects. So it seems I shall use jvoegele's plugin. But what surprises me is why not Android team and jvoegele come up with some plan to merge the two plugins so that there is only one gradle plugin for Android. That makes sense as jvoegele has put in some good effort into creating the plugin. – Santanu Nov 27 '12 at 17:56
1

The original Android gradle plugin by jvoegele is no longer supported, but the gap in features between com.android.tools.build plugin is shrinking.

Seth Rylan
  • 116
  • 1
  • 6
0

On the long term, I would surely go for the Android Tools Project; it is indeed work in progress, yet the android tooling group is very actively working on it. It is their intention to have this as the alternative for the current ant build system

roomsg
  • 1,811
  • 16
  • 22