I have migrated a project from Eclipse. The project still has the "old" project file structure from eclipse (see http://developer.android.com/tools/projects/index.html). Is there a way to automatically change the file structrue to the new system (see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Project-Structure)? If I understand http://developer.android.com/sdk/installing/studio-tips.html Project Structure section correctly this should have happended when migrating but it did not (maybe a mistake by me). So once again my questions: is it possible to change the file structure automatically? If not, what do I have to change? What do I have to change in the build.gradle? What are obsolete files / directories?
Thanks!
Stephan
While migrating your project from Eclipse to Android Studio, no change have been done on project structure. The only that have changed are new .iml and .gradle files.
Your java code stays in project/src/
folder, and has not been moved in project/src/main/java
folder (like in a new created project from AndroidStudio).
Your AndroidManifest
file also stays in the project/
folder and has not been moved in project/src/main/
folder (like in a new created project from AndroidStudio).
At migration, the build.gradle
file is customized in order to be able to compile with the old structure is described in the gradle documentation : Configuring the Structure
For a new created project in AndroidStudio, the sourceSets part of the build.gradle file :
sourceSets {
main.java.srcDirs = ['src/java']
main.resources.srcDirs = ['src/resources']
}
For a migrated project from Eclipse, the sourceSets part of the build.gradle file must be that :
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']
}
instrumentTest.setRoot('tests')
}
}
With that, you should be able to customize your project structure and build accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With