Create an as project compatible with Android studio and Eclipse
Although my blog is called Eclipse_xu, I have not used eclipse for nearly a year, and have already worshipped under Android studio. However, recent projects that are compatible with Eclipse and Android Studio allow some friends who are not yet out of poverty to be able to use the project created by as as well, so we found a way to be compatible with both Ant and Gradle to create a compatible project.
Create a normal Android studio project
Very simple, once created, we switch to the Project tab, where the directory structure is:
But Eclipse's directory structure is not so, so eclipse default ant cannot compile such a project, so we need to modify the directory:
Delete the main folder and move the code inside the Java folder into SRC as a code folder.
As shown in the following:
But you changed this, Gradle again, so, in this time of survival, we take the modification of the Build.gradle file.
Under the Android tab, add the configuration as shown below:
sourceSets { main { java.srcDirs = [‘src‘] res.srcDirs = [‘res‘] assets.srcDirs = [‘assets‘] jni.srcDirs = [‘jni‘] jniLibs.srcDirs = [‘libs‘] ‘AndroidManifest.xml‘ } }
I believe everyone can read, in fact, is to re-establish the corresponding folder, such as SRC, res and so on.
In this way, we switch to the Android tab, the structure of the display is actually the same as the original. However, such a project can be used as Lib library directly to the Eclipse Project reference.
Rumor: Importing Eclipse projects
In addition to exporting the Gradle project using Eclipse, import the Android Studio. We can also open Eclipse project directly, that is, direct open Eclipse project. However, most importantly, after the import, directly in the project configuration to remove the module, re-import module, again select the project we just imported, this time, as will prompt you to use Gradle to compile the project. This is also perfectly compatible with Eclipse and Android Studio.
Warning
While this article explains how to work with Android studio and Eclipse projects, it's a strong objection to continuing to use Eclipse for Android app development, you see Google IO, Android Studio has opened several of Eclipse's astronomical units, not using tools to innovate productivity, I can only say%¥%#......&& (...). ¥ ... ¥#*&.
Create an as project compatible with Android studio and Eclipse