This article is From:http://www.android-studio.org/index.php/docs/guide
Gradle User Manual (a): Why use Gradle? User Rating:/104
-
Last updated on November 09, 2013
-
hits: 43172
Original address: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7
Translation: Android Studio Chinese Group (sledgehammer translation)
Given that Android Studio uses Gradle to build projects, there are a number of headaches that can be encountered during the IDE's use. Sledgehammer is also the first contact, in order to have a basic understanding, special to find the official Android manual, and we learn together. Translation of the wrong place, I hope to point out.
Why do you use Gradle?
Gradle is a more advanced build system and a good build tool that allows custom build logic through plugins
The following are the main reasons why Android Studio chooses Gradle:
- Use domain-specific languages (domain specific Language) to describe and manipulate building logic. (hereinafter referred to as DSL)
- Based on groovy. DSLs can mix various declarative elements and manipulate these DSL elements in code to achieve logical customization.
- Support for existing MAVEN or Ivy warehouse infrastructure
- Very flexible, allowing the use of best practices, does not force you to follow its principles.
- Other plugins can expose their own DSL and API to let Gradle build files for use.
- Allows IDE integration, is a good API tool
Read more: Gradle user manual (a): Why use Gradle?
How to migrate projects in Eclipse to Android Studio User Rating:/63
-
Last updated on November 08, 2013
-
hits: 36549
English address: HTTP://DEVELOPER.ANDROID.COM/SDK/INSTALLING/MIGRATE.HTML
translation: Android Studio Chinese Group ( Sledgehammer translation )
If you have previously worked with Eclipse for Android, and now want to import projects from eclipse into the environment of Android studio, the first thing to do is to generate the files for build Gradle. Because Android Studio uses Gradle to manage projects, here's how to do it:
Read more: How to migrate projects in Eclipse to Android Studio
Gradle User's Manual (ii): Project structure User Rating:/53
-
Last updated on November 09, 2013
-
hits: 25626
Original address: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7
Translation: Android Studio Chinese Group (sledgehammer translation)
Continued Gradle (i)
Project structure
Two major components (source sets): Main source code and test code. They are in the following two directories:
src/main/
src/instrumenttest/
The two directories, respectively, have their own code source files and resource files.
java/
resources/
For Android plugin, the following additional directories are available:
Androidmanifest.xml
res/
assets/
aidl/
rs/
jni/
Read more: Gradle user manual (ii): Project structure
How to introduce a third-party jar package (take Google Play service as an example)User Rating:/24
-
Last updated on November 08, 2013
-
hits: 20664
Original address: http://forum.xda-developers.com/showthread.php?t=2421186
Translation: Android Studio Chinese Group (sledgehammer translation)
In the development of Android Studio (as), it is really annoying to encounter the introduction of an external class library or a third-party jar package. Because as is built on Gradle, it is somewhat different from the traditional way of importing.
I have had a headache for a while, now finally have a solution, take out and share with you.
Here is an example of how to import the Google Services library as follows.
1. Open your Buid.gradle file. Which one should I use? In project, or in module? (, in module)
2. Copy the Google-play-services.jar jar package to the specified location. It may have been in this directory: $ANDROID-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs, For example, now I put it in the $google_play_lib directory.
Read more: How to introduce a third-party jar package (take Google Play service for example)
Gradle User's Manual (iii): Building tasks User Rating:/23
-
Last updated on November 09, 2013
-
hits: 18433
Original address: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7
Translation: Android Studio Chinese Group (sledgehammer translation)
Continuation: Gradle (i) | Gradle (b)
Common Tasks
When a plugin is applied to the build file, a series of build tasks are automatically created to run. Both Java plugin and Android plugin will do the same.
We have the following four contracts for tasks:
- Assemble task, assemble all project outputs
- Check task, run all checksums
- Build task, both pooled and verified
- Clean task, clear all project outputs
Assemble, check and build tasks themselves do nothing, they are just plugin anchor points, the real task is to add execution by plugin.
The advantage of this is that you can invoke the same command to execute no matter what project you are in.
From the command line, you can get a higher level of task with the following command:
Gradle Tasks
List all tasks that are currently running, and view dependencies between them:
Gradle Tasks--all
Note: Gradle automatically detects the input and output declared in a task. When you repeat the build task two times, Gradle reports that all current tasks are up-to-date state.
Read more: Gradle user's Manual (iii): Build Tasks
Android Studio Reference Online article