我发现两个gradle android插件 - 两者之间有什么关系吗?

San*_*anu 6 android build-system gradle

我试图找出如何使用Gradle构建Android应用程序.令我惊讶的是,我找到了两个引用,一个来自jvoegele,另一个来自Android Tools Project站点.他们似乎表面上看起来不同.所以我的问题是为什么有两种变体?这两者之间有什么关系吗?他们目前的状况如何?我应该使用哪一个 - 它们的优点和缺点?似乎Android的一个刚刚开始.

我期待有一些宝贵的意见,他们拥有使用Gradle构建Android应用程序的第一手经验.

感谢致敬

Santanu

0x0*_*0me 1

我只是在玩 android 工具项目网站的 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))
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

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