Create an AS project compatible with Android Studio and eclipse, androideclipse
Create an AS project compatible with Android Studio and eclipse
Although my blog name is eclipse_xu, I have not used eclipse for more than a year and have long been under Android Studio. However, the latest project is compatible with eclipse and Android Studio, so that some friends who are not yet out of poverty can also use the projects created by the AS. Therefore, you have found a method that is compatible with both ant and gradle to create compatible projects.
Create a common Android Studio Project
It is very simple. After the creation, we switch to the project tag. The directory structure is as follows:
But the directory structure of eclipse is not like this, so the default ant of eclipse cannot compile such a project, so we need to modify the directory below:
Delete the main folder and move the code in the java folder to src as the code folder.
As shown in:
But you have changed this way, and gradle does not recognize it again. Therefore, we can modify the build. gradle file at the time of survival.
Add the following configuration under the Android Tag:
sourceSets { main { java.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jni.srcDirs = ['jni'] jniLibs.srcDirs = ['libs'] manifest.srcFile 'AndroidManifest.xml' } }
I believe everyone can understand it. In fact, it is to re-develop the corresponding folders, such as src and res.
In this way, we switch to the Android tag, and the display structure is actually the same as the original one. However, such a project can be directly referenced by the eclipse project as the lib library.
Upload: Import eclipse project
In addition to using eclipse to export the gradle project to Android Studio. You can also open the eclipse project directly. However, the most important thing is that after the import, you can directly Delete the module in the project configuration, re-import the module, and re-select the project we just imported. At this time, AS will prompt you to use gradle to compile the project. This is also perfectly compatible with eclipse and Android Studio.
Warning
Although this article explains how to be compatible with Android Studio and eclipse projects, it is opposed to continuing to use eclipse for Android App development. You can refer to Google IO 2015, android Studio has opened several astronomical units in eclipse. Without using tools to improve productivity, I can only say % ¥ % #...... &&(...... ¥ ...... $ #*&.