Android Studio Checkout and build the source code

https://android.googlesource.com/platform/tools/base/+/studio-master-dev/source.md


Like the Android operating system, Android Studio is open source and free of charge to all. Android releases source code to the Android Open Source Project (AOSP) after each stable release, described in detail here.

As of Android Studio 1.4, Android Studio is aligned to the same model of releasing source code after each stable release. For those who contribute to Android Studio, the code contribution process is the same as the Android platform.

Please continue to submit patches to the Android Studio AOSP branch.

We will do code-reviews and merge changes into subsequent versions of Android Studio. We're incredibly grateful to all of you in the community for your collaboration and hard work on Android Studio.

Doing a checkout

Download an install the repo tool to checkout the source of Android Studio.

Check out the latest published source code using the following commands in a shell:

$ mkdir studio-master-dev
$ cd studio-master-dev
$ repo init -u https://android.googlesource.com/platform/manifest -b studio-master-dev
$ repo sync -c -j4 -q

You can call the top level directory whatever you want. Those of us who check out multiple branches prefer to name the directories after the branches.

During the repo init command, it will ask you for your name and e-mail address which will be used by git if you commit changes and will be shown if you upload them for review.

To fetch the latest changes re-run the repo sync -c -j4 -q command.

  • -j, The number of parallel sync threads to start.

    For your first sync, during which your client will be pulling down everything, we recommend a low value such as -j4. For incremental syncs you can increase it as most fetch operations will be no-ops. However, specifying too high a number may decrease performance on machines with slow disks or slow internet connections.

  • -c, Syncs only the current branch to reduce sync time and disk space.

    This means you will not be able to cherry-pick changes from branches you didn't sync.

  • -q, Quiet. The normal output is fairly verbose.

See https://source.android.com/source/using-repo for more information about how to use repo.

Building

To build Android Studio, see Building Android Studio

To build the Android Gradle plugin, see Building the Android Gradle Plugin.

The parts of the SDK that can be built with the studio-* branches are only the IDE components and the SDK Tools. Each component is built differently due to varying build systems.

None of them use the make-based build system of the platform.

Historically, building the Android tools required building the full Android SDK as well. However, we've been gradually migrating the tools source code over to a more independent setup, and you can now build the Android Studio IDE without a full Android checkout and without a C compiler etc.

Check out a specific release

Releases since Android Studio 2.4 are tagged in git. This means you can use the tag to get the source code for a specific version. The tags are of this form:

  • Gradle: gradle_x.y.z
  • Studio: studio-x.y

You can see all available tags here: https://android.googlesource.com/platform/manifest/+refs

For instance you can do a checkout of version 2.3.0 of the Gradle plugin with the following command:

$ repo init -u https://android.googlesource.com/platform/manifest -b gradle_2.3.0
$ repo sync

Releases before studio-1.4 were developed in AOSP in the following branches

development branch
release branch
IntelliJ
Notes

studio-1.0-dev
studio-1.0-release
idea13-dev
This was the branch for 1.0 work

studio-1.1-dev
studio-1.1-release
idea13-1.1-dev
This was the branch for 1.1 work

studio-1.2-dev
studio-1.2-release
idea14-1.2-dev
This was the branch for 1.2 work

studio-1.3-dev
studio-1.3-release
idea14-1.3-dev
This was the branch for 1.3 work

Android Studio does not use the master branch. The branches ub-tools-idea133 and ub-tools-master are deprecated.

posted @ 2021-10-10 22:29  beansoft  阅读(53)  评论(0编辑  收藏  举报