是否有可能使用的摇篮构建系统为Android与Eclipse?有可能、摇篮、系统、Eclipse

2023-09-12 01:13:43 作者:奶味刀

我有一个应用程序,需要在建立多次使用不同的资源,不同的客户(品牌,配置,和客户之间的pre加载数据的变化)。

I've an app that needs to be build multiple times with different resources for different customers (branding, configuration, and pre-loaded data change between customers).

在今年的谷歌I之后/ O我听说过的新摇篮 - 基于Android编译系统。因此,我认为,这将是一个不错的主意,用摇篮构建脚本来实现这一个来源/多的apk的情况。

In the wake of this year's Google I/O I've heard about the new Gradle-based Android build-system. So I thought, it would be a good idea, to realize this one-source/multiple-apks scenario using a Gradle build script.

现在,这里是我的问题:我如何开始使用摇篮的建设,同​​时坚持到Eclipse?所有读取我在网上找到点项目转换为尚不成熟的Andr​​oid工作室。我想推迟迁移到Android的工作室,直到该声明为安全通过谷歌产品中使用。

Now here comes my question: How can I get started using Gradle for building while sticking to Eclipse? All the reads I found online point to converting the project to the still immature Android Studio. I'd like to put off migrating to Android Studio until that's declared "safe" for production use by Google.

在理想情况下,我想能够钩生成脚本(县)的Eclipse的调试和运行配置,大同小异的方式,我可以挑选不同的构建目标进行调试和归档的X $ C $℃。如果可能的话,需要哪些步骤,使这项工作?

Ideally, I'd like to be able to hook the build script(s) to the Debug and Run Configurations of Eclipse, very much the same way as I can pick and choose different build targets for debugging and archiving in XCode. If that's possible, what steps are required to make that work?

我对这些问题的noobish质量表示歉意,但对我来说这还算是一个未被发现的国家。任何帮助是AP preciated。

I apologize for the noobish quality of these questions, but for me this is actually quite an undiscovered country. Any help is appreciated.

编辑: 我们的团队已迁移到Android工作室在2013年10月下旬以来版本0.4中遇到越来越少的错误。如果您的组织不超保守的采用pre-1.0环境的发展,我会鼓励你跳进冷水中,并尝试与Android Studio及其摇篮构建系统的工作。唯一重要的事情恕我直言,缺少的是对单元测试体面的支持。

Our team has migrated to Android Studio in late October 2013 and since version 0.4 were are encountering fewer and fewer bugs. If your organization is not super-conservative about adopting pre-1.0 environments for development, I'd encourage you to jump into the cold water and try working with Android Studio and its Gradle build system. The only important thing missing IMHO is decent support for unit-testing.

推荐答案

有可能使用2版本的系统(Eclipse的+摇篮为主)。只要确保输出文件夹是不同的(的ADT,建立的摇篮)。 (更新TL; DR:检查Nodeclipse/Enide摇篮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) )

文件 - >出口 - >生成摇篮构建文件将只需添加 build.gradle 下面的内容(但检查的版本)。没有现成的文件被更改。

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 的版本应该是的最新。 对于摇篮式摇篮构建在http://tools.android.com/tech-docs/new-build-system/user-guide.尝试摇篮任务更多。 (在我的互联网连接速度较慢它耗时1小时!为摇篮下载所有需要的依赖)

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教程http://www.vogella.com/articles/AndroidBuild/article.html还没有准备好。其他的在线教程是不是真的完成http://www.jayway.com/2013/02/26/using-gradle-for-building-android-applications/

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还没有使用摇篮,我觉得会的Andr​​oid Studio中打磨第一。这将是不那么明智的做法是开始使用不断发展的技术在这两个IDE中在同一时间。

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.

下面参见 build.gradle 的例子。如果你已经掌握了摇篮,那么也许奇才队是没有必要的。 有关最新的 build.gradle 模板经典的Andr​​oid项目检查gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.

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-捆绑不来与Eclipse的市场,所以更新站点都可以使用。

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

更新P2存储库摇篮集成为Eclipse 是

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

但由于3.4.0版本,它不提供编辑器.gradle文件。 因此,有没有感觉有它的Andr​​oid开发的。

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.

我会用默认的ADT版本去,有摇篮的二次搭建experimentations 并密切关注当错误在http://tools.android.com/tech-docs/new-build-system变得罕见。 (这应该是各地的正式版本1.0)

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)

更新:2014年4月15日

UPDATE: 2014-04-15

亚历克斯·鲁伊斯的(从Android团队)博客关于Android,摇篮和放大器; ADT

而不是创造的IDE专用的Andr​​oid /摇篮机型,我们决定有一个摇篮工程的IDE无关的再presentation。这样,我们具有单一的信息源,其更容易维护。 IDE集成将实现为一个插件,每个支持的IDE(在我们的例子中,Eclipse和IDEA)。这种方法的主要好处是,我们可以释放摇篮插件独立的IDE集成插件。例如,我们可以出货了Eclipse的新版本的插件,有几个bug修复,不影响机器人的摇篮边。

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.

截至4月的2014年日食 - 摇篮插件是无法与Android的摇篮插件兼容的:

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

作为由Android团队回答发行57668 (由@上调arcone)

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

项目成员#2×... @ a​​ndroid.com

Project Member #2 x...@android.com

的Eclipse插件是无法与Android插件兼容。

The eclipse plugin is not compatible with the android plugin.

您将无法使用默认的摇篮支持在Eclipse中导入Android的摇篮项目到Eclipse中。

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

要使它在Eclipse中工作,我们将不得不改变摇篮的Eclipse插件,我们正在修改的摇篮支持的IntelliJ以同样的方式

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

这是Android团队正在摇篮插件的IntelliJ和摇篮的Eclipse插件必须得更新。

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

有努力在Nodeclipse 平滑的过渡时间。并不断在Eclipse来开发,同时还尝试或充分利用摇篮。

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摇篮Eclipse的 (市场)

一些屏幕截图摇篮为Eclipse:

Some screenshots for Gradle for Eclipse:

 
精彩推荐
图片推荐