How to setup a local Android SDK repository mirror

跳转至: 导航搜索
  1. mkdir -p /opt/mirrors/android
  2. yum -y install nginx wget git libxslt xsltproc
  3. cd /opt/mirrors/android
  4. git clone
  5. config nginx server:
    server {
        listen  80;
        location / {
                root /opt/mirrors/android/android-repository
                autoindex off;

For Standalone SDK Manager

Server (Repository) setup

cd /opt/mirrors/android/android-repository


Client (SDK Manager) setup
wget http://${MIRROR_HOST}/`wget http://${MIRROR_HOST}/studio/ -O - | perl -nle "print $& if m{android/repository/sdk-tools-${OS}-\}"`
unzip sdk-tools-*.zip
tools/bin/sdkmanager --no_https --proxy=http --proxy_host=${MIRROR_HOST} --proxy_port=80 "patcher;v4" "extras;android;m2repository" "extras;google;m2repository" emulator "build-tools;25.0.3" "platforms;android-25" platform-tools tools "sources;android-25"

(Optional) SDK web manager setup

It's a single page app for exploring the packages downloaded. To make it work,

yum install nodejs

npm install -g bower
  1. In your web root directory, (backup your index.html, and) run

It will copy over three files and one directory.

  • index.html
  • .bowerrc
  • bower.json
  • elements/
  1. Install bower (requires nodejs,, and run the following command line
  2. bower i -F -S

For Android Studio Built-in SDK Manager

Server (Repository) setup


  • Files will be downloaded to your working directory.
  • ANDROID_REPOSITORY_HOME is the directory holding the files of the project.
  • A sample httpd vhost config will be printed on download complete

Client (Android Studio) setup

Set environment variable before launching Android Studio.


more details, refer to: