Android Studio and androidstudio
Android Studio class-1. Brief Introduction
Android Studio class 2. Download, install, and initialize
Android Studio-3. Create or import an APP
Android Studio-4.1.Coding-positioning Objectives
Android Studio-4.2.Coding-code writing
Android Studio-4.3.Coding-use third-party Libraries
Android Studio-4.4.Coding-Shortcut Key
Android Studio class 5. Compilation, operation, debugging, and optimization
Android Studio class 6. 1. Package-Details build. gradle
Android Studio class 6. 2. Packaging-umeng multi-channel Package example
Android Studio-7.1 extended functions-screenshots or recorded videos
Android Studio-7.2 extended functions-Quick import of the Sample APP officially provided by Google
Android Studio class 8. Eclipse project development without changing the existing directory structure
Generally, earlier projects were structured in eclipse, but in today's era when Android Studio is the only official standard, Android Studio seems to be a little outdated. However, some companies cannot directly change the gradle structure for various reasons. This article is to help you still use Android Studio to develop these old Android apps without changing the project structure.
First, let's take a look at the structure of the gradle project:
MyApplication: root directory of the entire project
- Settings. gradle: Configure which folders are modules. In this example, the app folder is a module.
- Build. grade: Overall project configuration, including maven library and Android plug-in version
- Gradle/: configure the gradle version
- Gradlew & gradlew. bat: The gradle packaging command on unix and windows, which can be automatically downloaded and used
- Gradle. properties: The gradle configuration file, which is empty by default. Some additional configurations can be read from this file during compilation.
- Local. properties: Same as gradle. properties is the same as the gradle configuration file. By default, only the path of the local sdk is available. However, different configurations related to the local sdk are usually stored in this file, for example, some local software-dependent paths and sensitive information must be ignored in version control.
- App: directory where app-related code is stored. This directory has been configured in the settings. gradle file as a module
- App/libs: Dependent Library
- App/src: source code, including the java source code list file and various resources
- App/build. gradle: gradle compile script file
In gradle, the module is equivalent to the project in eclipse. The advantage is that gradle can support multiple modules in a project and compile multiple modules at the same time, this is a killer for complicated projects.
Next, we will change the app directory to the eclispe structure based on the gradle project.
1. Delete the androidTest directory
2. Move all the files in the java directory to the src directory.
3. Move the res directory to the app directory
4. Move AndroidManifest. xml to the app directory.
5. If the assets directory exists, move the assets Directory to the app directory.
6. If there is a jni directory, move the jni directory to the app directory.
7. If the jniLibs directory exists, move the content in the jniLibs directory to the libs directory.
8. Configure the directory of the android node in the build. gradle file under the app directory through sourceSets, as shown below:
At this point, you can synchronize gradle to run it directly.
What should we do when we already have an eclipse project?
1. Create a project through Android Studio
2. Copy the eclipse project (same as the app directory)
3. configure it in the settings. gradle file to make it a module
4. Copy the build. gradle file under the app directory to the eclipse project directory.
5. Modify applicatoinId and minSdkVersion in build. gradle according to packageName and minSdkVersion in AndroidManifest. xml under the eclipse project directory.
6. Configure sourceSets in build. gradle as follows
7. Delete the app directory and delete the corresponding configuration in the settings. gradle file.
8. Open the settings page of Android Studio, click the plus sign in the lower left corner of Version Control, and select eclipse project directory to activate Version Control.
9. In version control, configure to ignore the build. gradle file, build directory,. idea directory, and *. iml File
10. Now we are done.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.