Skip to content

Instantly share code, notes, and snippets.

@joshfriend
Last active July 23, 2018 17:16
Show Gist options
  • Save joshfriend/ee2ae306b2c5c363d5a05e5af04cba95 to your computer and use it in GitHub Desktop.
Save joshfriend/ee2ae306b2c5c363d5a05e5af04cba95 to your computer and use it in GitHub Desktop.

Credit to @cketti for the original steps

If you are annoyed that "Sources for Android 28" are not yet available via SDK manager, this might be for you:

  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 https://android.googlesource.com/platform/frameworks/base -b android-p-preview-3 frameworks/base
git clone --depth 1 https://android.googlesource.com/platform/libcore -b android-p-preview-3
git clone --depth 1 https://android.googlesource.com/platform/development -b android-p-preview-3

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

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

# Run the script to create android-28-sources.zip
python my_mk_sources_zip.py -z source.properties android-28-sources.zip .
  1. Extract into Android SDK source directory
unzip android-28-sources.zip -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