Android Studio Big Classroom-8. Do not change the existing directory structure develop eclipse projects

Source: Internet
Author: User

Android Studio Big Classroom-1. Brief introduction
Android Studio Big Class-2. Download installation and initialization
Android Studio Big Classroom-3. Create or import an app
Android Studio Big Classroom-4.1.Coding-positioning target
Android Studio Big Classroom-4.2.Coding-write code
Android Studio Big Classroom-4.3.Coding-use third-party libraries
Android studio Big Class-4.4.Coding-shortcut keys
Android Studio Big Classroom-5. Compile & Run & Debug & Optimize
Android Studio Big Classroom-6.1. Packaging-Detailed Build.gradle
Android Studio Big Classroom-6.2. Packaging-Friends multi-channel Package sample
Android Studio Big Classroom-7.1 extensions-screenshot or record video
Android Studio Big Classroom-7.2 extensions-fast import of Google's officially available sample APP
Android Studio Big Classroom-8. Do not change the existing directory structure develop eclipse projects

Most of the earlier projects were eclipse-structured, but in the days when Android studio was officially the only standard, no Android studio seemed a bit behind. But some companies can not directly change to the GRADLE structure for a variety of reasons, so today this article is to help you do not change the project structure of the situation still use Android studio to develop these old Android apps.

Let's start by looking at what the structure of the Gradle project looks like:

MyApplication: The root directory of the entire project

  • Settings.gradle: Configure which folders are module, in this example project the App folder is a module
  • Build.grade: Project overall configuration, including Maven library and Android plugin version
  • gradle/: Configuring the Gradle version
  • Gradlew&gradlew.bat:unix and Gradle wrapper commands on Windows Enable automatic download and use of Gradle
  • The Gradle.properties:gradle configuration file, which is empty by default, can read some additional configuration from this file during compilation
  • Local.properties: Same as Gradle.properties is also the Gradle configuration file, the default is only the path of the local SDK, but the difference is usually the local-related configuration will be put into this file, such as some local dependent software path and sensitive information, it is often necessary to this file in the version Ignore in this control
  • App:app the directory where the relevant code is stored, this directory is already configured in the Settings.gradle file is a module
  • App/libs: Dependent libraries
  • APP/SRC: Source code, including Java source inventory files and various resources
  • App/build.gradle:gradle Compiling script files

In Gradle, the module is equivalent to project in Eclipse, and the benefit is that Gradle can support multiple module in a project and compile multiple module at the same time, which is a killer for more complex projects.

Next, we'll start by changing the app directory to the ECLISPE structure on the basis of the Gradle project.
1. Delete the Androidtest directory
2. Move all files in the Java directory to the SRC directory
3. Move the Res directory to the app directory
4. Move the Androidmanifest.xml to the app directory
5. If you have a assets directory, move the assets directory to the app directory
6. If there is a JNI directory to move the JNI directory to the app directory
7. If you have a jnilibs directory, move the contents of the Jnilibs directory to the Libs directory
8. In the Android node in the Build.gradle file under the app directory, configure the relevant directory via Sourcesets, as follows:

Now that you are done, sync your gradle and run it directly.

And what do we do when we have an eclipse project?
1. First create a project from Android studio
2. Copy the Eclipse project (similar to the app directory)
3. Configure it in the Settings.gradle file to become a module
4. Copy the Build.gradle file from the app directory to the Eclipse project directory
5. Modify Applicatoinid and Minsdkversion in Build.gradle according to PackageName, minsdkversion in the Androidmanifest.xml file under the Eclipse project directory
6. Configure Sourcesets in Build.gradle as that
7. Delete the app directory and delete the configuration in the Settings.gradle file
8. Open the Settings page of Android Studio, click the plus sign in the bottom left corner in version control to select Eclipse Project directory to activate versioning
9. Configure the Ignore Build.gradle file, build directory,. Idea directory, and *.iml file in version control
10. This is done.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Studio Big Classroom-8. Do not change existing directory structure develop eclipse project

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.