Skip to main content
 首页 » 编程设计

eclipse之是否可以在团队中使用 Android Studio 和 Eclipse

2025年05月04日6798°冷暖

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

请您参考如下方法:

您需要设置一个供 Android Studio 使用的 Gradle 构建文件,并单独维护 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') 
    } 
}