Skip to content

Instantly share code, notes, and snippets.

Forked from cketti/
Created September 4, 2019 15:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Kisty/7d989c892aa5503a45128825bc6a43c6 to your computer and use it in GitHub Desktop.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment