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

4

3 回答 3

1

不再支持jvoegele 原来的 Android gradle 插件,但插件之间的功能差距com.android.tools.build正在缩小。

于 2013-04-06T21:17:33.910 回答
1

我只是在玩 android tools 项目站点的 gradle 插件,感觉很难弄清楚事情应该如何工作。它不是很好地集成到 eclipse 开发工作流程中,甚至 eclipse 的默认项目配置对我来说也不起作用。可以通过扩展项目和类路径文件创建并修改 gradle 构建文件中的项目布局来解决此问题。

为了修复 eclipse 项目的创建,我受到了 jvoegele 插件的启发(学分去那里):

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))
            }
        }
    }
}

如果你想让你的项目快速高效,这个插件不适合你。

于 2012-11-26T16:23:03.320 回答
0

从长远来看,我肯定会选择 Android 工具项目;它确实在进行中,但 android 工具组正在非常积极地致力于它。他们打算将此作为当前 ant 构建系统的替代方案

于 2013-01-08T11:25:34.593 回答