This problem is certainly unavoidable, fortunately, the project catalog of Android Studio is far more clear than Eclipse.
Catalog comparison
We created a Eclipsedemo Android project in Eclipse and created a My application Android project in Android Studio, with the module named app.
Ide |
Eclipse |
Android Studio |
Manager directory |
|
|
File directory |
|
|
One thing to note is that a project in Gradle is a working directory that is isolated from other project, and project can add a module that can be understood as Android The module in studio corresponds to project in eclipse, but this is not true. In the case of Android Studio's support for various tools like Maven and Git, project in Android Studio should be the source code repository permission for your project, so it's a mouthful, remember a guideline: Your IDE should be invisible to the source, whether it's a jar or an Android Library.
In Android Studio the app corresponds to our Eclipsedemo, and its own project My application corresponds to workspace.
See the Eclipse and as (typing too annoying) source code path is not the same, but think of our last article of the Baseextension.groovy, change the configuration is OK, do not move the folder.
First step: Add Build.gradle to the project catalog in eclipse
We copy the Build.gradle of the app in our application to the Eclipsedemo directory, add the source path configuration
Apply plugin: ' Com.android.application ' android {compilesdkversion buildtoolsversion "21.1.1" Defaultconfig { ApplicationID "Suning.com.myapplication" Minsdkversion targetsdkversion versioncode 1 Versionname "1.0"} buildtypes {release {minifyenabled false proguardfiles Getde Faultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}//Add Eclipse Source path Sourcesets {ma In {manifest {srcfile ' androidmanifest.xml '} java {SRCD IR ' src '} res {srcdir ' res '} assets {Srcdir ' Assets '} resources {srcdir ' src '} aidl {src Dir ' src '}}}}dependencies {compile filetree (dir: ' Libs ', include: [' *.jar '])}
Step two: Copy the entire Eclipsedemo folder to the path of my application and modify the Myapplication.iml file
This file is a configuration file for the IDE Project directory and is used to configure the module that the as needs to be displayed, and we want to add a module:
<?xml version= "1.0" encoding= "UTF-8"? ><module external.linked.project.id= "MyApplication" External.linked.project.path= "$MODULE _dir$" external.root.project.path= "$MODULE _dir$" external.system.id= "GRADLE "External.system.module.group=" "external.system.module.version=" unspecified "type=" Java_module "version=" 4 "> <component name= "Facetmanager" > <facet type= "java-gradle" name= "Java-gradle" > <configuration> <option name= "Build_folder_path" value= "$MODULE _dir$/build"/> <option name= "buildable" value= "false" /> </configuration> </facet> </component> <component name= "Newmodulerootmanager" Inheri T-compiler-output= "true" > <exclude-output/> <content url= "file://$MODULE _dir$" > <excludefold Er url= "file://$MODULE _dir$/.gradle"/> </content> <orderentry type= "inheritedjdk"/> <orderent Ry type= "Sourcefolder" fortests= "false"/> </component></module><!--Add a module--! ><module external.linked.project.id= "Eclipsedemo" External.linked.project.path= "$MODULE _dir$" external.root.project.path= "$MODULE _dir$" external.system.id= "GRADLE "External.system.module.group=" "external.system.module.version=" unspecified "type=" Java_module "version=" 4 "> <component name= "Facetmanager" > <facet type= "java-gradle" name= "Java-gradle" > <configuration> <option name= "Build_folder_path" value= "$MODULE _dir$/build"/> <option name= "buildable" value= "false" /> </configuration> </facet> </component> <component name= "Newmodulerootmanager" Inheri T-compiler-output= "true" > <exclude-output/> <content url= "file://$MODULE _dir$" > <excludefold Er url= "file://$MODULE _dir$/.gradle"/> </content> <orderentry type= "inheritedjdk"/> <orderent Ry type= "Sourcefolder" fortests= "false"/> </component></Module>
Step three: Modify the setting.gradle of my application
This setting.gradle has been mentioned in the second article, you can increase the dependency configuration of project, now we just need to add a module.
Include ': App ', ': Eclipsedemo '
Restart Android Studio to do it.
Fourth article: The Eclipse Android App project migrated to Android Studio