Create an as project compatible with Android studio and Eclipse

Source: Internet
Author: User

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

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.