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