Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Build your own android-28 sources

Build "Sources for Android 28" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base

# Fetch repositories that contain the sources we're interested in
git clone --depth 1 -b android-9.0.0_r3 frameworks/base
git clone --depth 1 -b android-9.0.0_r3
git clone --depth 1 -b android-9.0.0_r3

# Create a basic file
echo -e "Pkg.UserSrc=false\nPkg.Revision=1\nAndroidVersion.ApiLevel=28" >

# Modify the script to create a sources ZIP to use "android-28" as top-level directory
cat development/build/tools/ | sed -e 's/TOP_FOLDER = .*/TOP_FOLDER = "android-28"/' >

# Run the script to create
python -z .
  1. Extract into Android SDK source directory
unzip -d ${ANDROID_HOME}/sources
  1. Restart Android Studio and SDK sources should show up.

This comment has been minimized.

Copy link
Owner Author

@cketti cketti commented Aug 7, 2018

Or just download the ZIP: (32 MB)


This comment has been minimized.

Copy link

@rock3r rock3r commented Aug 7, 2018

I like the lazy approach 👍 thanks @cketti!


This comment has been minimized.

Copy link

@MIkeeJY MIkeeJY commented Aug 24, 2019

Anyone got android sdk 29 source code?


This comment has been minimized.

Copy link

@consp1racy consp1racy commented Sep 3, 2019


Replace android-9.0.0_r3 branches with android10-release branches.

# Create a basic file
echo -e "Pkg.UserSrc=false\nPkg.Revision=0\nAndroidVersion.ApiLevel=29" >

I used Pkg.Revision=0 so SDK manager can update to official revision 1 when it comes out.

Replace android-28 in the last two commands with android-29.

python .

I dropped the -z option because I run in Windows and there's no "zip system exec". You'll need Python 2.7 to run the script.

The rest is the same.


This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment