Create an AS project compatible with Android Studio and eclipse, androideclipse

Source: Internet
Author: User

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 % ¥ % #...... &&(...... ¥ ...... $ #*&.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.