Official Android Technical Documentation translation-Development Tool construction overview, android Technical Documentation
This article is translated from the official Android Technical Document Build Overview. The original Article address is http://tools.android.com/build.
Because the "Android Lint Checks" is too long to be translated, this time I will post the "Build Overview" translation.
This article describes how to build Android development tools, such as Android Studio, Android Gradle plug-in, SDK, and ADT.
It is not easy to translate. For more information, see the source on the CSDN blog:
Http://blog.csdn.net/maosidiaoxian/article/details/44451007
The translation work is time-consuming. If you think the translation is still OK, there is a "TOP" word at the end of the article. You know, I hope you can support it a lot. If any error occurs, please correct it. Thank you.
Note: you cannot download the code because of the GFW relationship. You can refer to the article on downloading Android source code in this blog.
Build Overview
Directory
- 1Obtain source code
- 1.1Several branches
- 1.2Detects a specific release branch.
- 2Build
- 2.1Build Android Studio
- 2.2Build Android Gradle plug-in
- 2.3Build the SDK for Linux and MacOS
- 2.4Build Eclipse-based tools.
- 2.5Other Tools
Obtain several source code branches. Currently, we have the following possible branches:
Development Branch |
Release Branch |
IntelliJ |
Remarks |
Studio-1.0-dev |
Studio-1.0-release |
Idea13-dev |
This is a branch for 1.0.Disabled |
Studio-1.1-dev |
Studio-1.1-release |
Idea13-1.1-dev |
This is a branch used for 1.1 that has been closed |
Studio-1.2-dev |
Studio-1.2-release |
Idea14-1.2-dev |
This is a branch for 1.2.Only fixing bugs |
Studio-1.3-dev |
Studio-1.3-release |
Idea14-1.3-dev |
This is a branch for 1.3. |
Studio-master-dev |
Studio-master-dev |
Idea14-dev |
This branch is used for submission to 1.3 |
The current development branch is a studio-1.2-dev.
We merge automatically in the following order: studio-1.0-dev-> studio-1.1-dev-> studio-1.2-dev-> studio-1.3-dev-> studio-master-devub-tools-idea133-> and ub-tools-master branch are disabled. We didn't use the master branch either.
Check out the code first, you need to install some prerequisites for your platform. This means you need git, C compiler, and so on. There are quite a few steps here, and all of them depend on the platform. Therefore, go to the official building introduction, where we have a detailed description: http://source.android.com/source/initializing.html.
Some requirements are not required (such as case-sensitive file systems) unless you plan to build this platform. You also need XCode to build the simulator.
Once you have configured everything, follow the instructions below to download the "repo" tool: http://source.android.com/source/downloading.html
Then you can use the following command in shell to check out the source code:
$ mkdir studio-1.3-dev
$ cd studio-1.3-dev
$ repo init -u https://android.googlesource.com/platform/manifest -b studio-1.3-dev
$ repo sync
(Obviously, you can create a top-level directory that you want. Those of us who have detected multiple branches prefer to rename the directory after the branch.
During the execution of the repo init command, it will ask you about the name and email address; if you decide to record your changesets and upload it for review, they will be used later. Check out a specific release branch. We are starting to mark the release version. This means that you can use tags to obtain the source code of a specific version. We are currently using the following mark:
Gradle |
Gradle_x.y.z |
Studio |
Studio_x.y.z |
You can see all available markup here: https://android.googlesource.com/platform/manifest/+refs
For example, you can use the following command to check out the Gradle plug-in of version 1.0.0:
$
Repo init-u https://android.googlesource.com/platform/manifest-B gradle_1.0.0
$ repo sync
The SDK that can be built through studio-* branches is only the IDE component and SDK Tools. Because the system cannot be built, the construction of each component is different.
They do not use the make-based platform to build a system to build Android Studio. Historically, building Android tools also requires building the entire Android SDK, because, for example, simulators, system image is required ).
However, we have gradually migrated the source code of tools to a more independent Installer. Now you can build Android Studio IDE without completely detecting Android and C compilers. Descriptions of building Android Studio are listed on the building Android Studio page. The rest of this document records the construction of other tools (Eclipse plug-ins, simulators, etc) for instructions on how to build the Android Gradle plug-in, see generating the Android Gradle plug-in. Build Linux and MacOS sdks. Only SDK Tools are generated. Follow these steps:
$ mkdir -p out/dist
$ ./tools/buildSrc/servers/build_tools.sh `pwd`/out `pwd`/out/dist 1234
This will build SDK Tools for your current platform. The build result is in the out/sdk/
Composed of the following content
- Simulators and associated executable files and Class Libraries
- Java-based independent tools
- Monitor
Only Java-based tools are used. You can open the IJ project in tools/base.
To build or test only java tools:
$ cd tools/
$ ./gradlew assemble // builds only
$ ./gradlew check // runs tests as well.
Build Windows SDK
These operation guides are outdated. The new guide is coming soon.
The complete Windows SDK build is only supported on Linux-most of the frameworks are not designed for building on Windows, so technically speaking, windows SDK is built on the Linux SDK with some binary files replaced ..
Installation:
$ sudo apt-get install mingw32 tofrodos
Mingw32 is a cross compiler, while tofrodos adds a unix2dos command.
Used for building:
$ . build/envsetup.sh
$ lunch sdk-eng
$ make win_sdk
Note that this will first build the Linux SDK and then the Windows SDK. The build result is located
Out/host/windows/sdk/android-sdk_eng.
Username_ Windows/
Build Eclipse-based Tools. To set the Eclipse environment for building and edit and debug the Eclipse plug-in for Android, refer to the "build Eclipse-based Tools" document. The next step is to prepare and install the tool based on the project you want to work on:
- Traceview, Hierarchy Viewer and DDMS are all to be installed, as follows:
- The core logic is located in Java projects under sdk/traceview, sdk/hierarchyviewer2, and sdk/ddms respectively. Import these projects to Eclipse.
- The above project will generate jar files, which are then referenced by their corresponding plug-ins. Traceview plug-ins, hierarchyviewer plug-ins, and ddms plug-ins are all located under sdk/eclipse/plugins.
- To-do list: Instructions for adding Simulators