How to setup a local Android SDK repository mirror
跳到导航
跳到搜索
- mkdir -p /opt/mirrors/android
- yum -y install nginx wget git libxslt xsltproc
- cd /opt/mirrors/android
- git clone https://github.com/renfeng/android-repository.git
- config nginx server:
server {
listen 80;
server_name android.koorka.com dl.google.com dl-ssl.google.com;
location / {
root /opt/mirrors/android/android-repository
autoindex off;
}
}
For Standalone SDK Manager
Server (Repository) setup
cd /opt/mirrors/android/android-repository
./download.sh
Client (SDK Manager) setup
MIRROR_HOST=android.koorka.com
OS=linux
#OS=darwin
#OS=windows
wget http://${MIRROR_HOST}/`wget http://${MIRROR_HOST}/studio/ -O - | perl -nle "print $& if m{android/repository/sdk-tools-${OS}-\d+.zip}"`
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
- In your web root directory, (backup your index.html, and) run
${ANDROID_REPOSITORY_HOME}/setup-sdk-web-manager.sh
It will copy over three files and one directory.
- index.html
- .bowerrc
- bower.json
- elements/
- Install bower (requires nodejs, https://nodejs.org/), and run the following command line
- bower i -F -S
For Android Studio Built-in SDK Manager
Server (Repository) setup
Note
- 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
${ANDROID_REPOSITORY_HOME}/download2.sh
Client (Android Studio) setup
Set environment variable before launching Android Studio.
export SDK_TEST_BASE_URL=http://android.koorka.com/android/repository/
more details, refer to: https://github.com/renfeng/android-repository