【问题标题】:Is it possible to use Android Studio AND Eclipse in a team是否可以在团队中使用 Android Studio 和 Eclipse
【发布时间】:2014-08-29 03:47:38
【问题描述】:

Android Studio 重新安排了从 eclipse 导入的项目的结构。我刚刚加入了一个使用 Eclipse 的团队,但我想使用 Android Studio 并尽可能少地影响他们当前的工作实践。一个团队是否可以使用 2 个 IDE 并共享同一个 repo?

【问题讨论】:

    标签: eclipse jar android-studio android-gradle-plugin


    【解决方案1】:

    您需要设置一个 Gradle 构建文件以供 Android Studio 使用,并单独维护 Eclipse 项目文件;不会有自动的方式来保持两者同步。

    基于 Gradle 的项目喜欢具有与旧式 Eclipse 项目不同的目录结构;您需要调整 Gradle 项目以使用 Eclipse 样式的目录。

    Maintaining directory structure during Android Studio import 有一些关于如何做到这一点的建议,但基本的想法是像这样设置你的构建文件:

    android {
        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')
        }
    }
    

    【讨论】:

    • 好的 Scott 我很快就会尝试这个,快速的问题,虽然我需要从 Eclipse 导出然后将 build.gradle 更改为这样吗?还是导入 Eclipse 项目本身更容易/更易于管理?谢谢。
    • 我会导入 eclipse 项目本身。我知道它并没有真正记录在案,但目前,从 Android Studio 导入 Eclipse 比从 Eclipse 导出 Gradle 更强大。
    • 感谢 Scott,我被直接导入 Android Studio 推迟了,因为它会复制整个项目,并且由于我对 Git 的糟糕了解而提交我们的 repo 会有点尴尬:D 幸运的是,我成功地导出了 Eclipse gradle 文件,实际上没有太多麻烦,所以现在我很高兴。
    猜你喜欢
    • 1970-01-01
    • 2022-10-25
    • 2018-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-06
    • 2022-01-12
    相关资源
    最近更新 更多