Android Studio重新安排从eclipse导入的项目结构.我刚刚加入了一个使用Eclipse的团队,但我想使用Android Studio并尽可能少地影响他们当前的工作实践.无论如何,团队可以使用2个IDE并共享相同的仓库吗?
解决方法
您需要设置一个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') } }