官網(wǎng)下載Android Studio安裝包后安裝啟動(dòng)Android Studio,程序提示安裝SDK,因?yàn)榇?翻墻的原因,安裝component失敗翎苫,錯(cuò)誤如下:
Preparing "Install Android SDK Platform-Tools (revision: 28.0.0)".Downloading https://dl.google.com/android/repository/platform-tools_r28.0.0-windows.zip"Install Android SDK Platform-Tools (revision: 28.0.0)" ready.Installing Android SDK Platform-Tools in D:\Android\sdk\platform-tools"Install Android SDK Platform-Tools (revision: 28.0.0)" complete."Install Android SDK Platform-Tools (revision: 28.0.0)" finished.Preparing "Install Android Support Repository (revision: 47.0.0)".Downloading https://dl.google.com/android/repository/android_m2repository_r47.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/android_m2repository_r47.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android Support Repository: Cannot download 'https://dl.google.com/android/repository/android_m2repository_r47.zip': SSL peer shut down incorrectly, response: 200 OK."Install Android Support Repository (revision: 47.0.0)" failed.Preparing "Install Android SDK Tools (revision: 26.1.1)".Downloading https://dl.google.com/android/repository/sdk-tools-windows-4333796.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Tools: Cannot download 'https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip': Read timed out, response: 200 OK."Install Android SDK Tools (revision: 26.1.1)" failed.Preparing "Install SDK Patch Applier v4 (revision: 1)".Downloading https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bakjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bak': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package SDK Patch Applier v4: Cannot download 'https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bak': Read timed out, response: 200 OK."Install SDK Patch Applier v4 (revision: 1)" failed.Preparing "Install Android Emulator (revision: 27.3.8)".Downloading https://dl.google.com/android/repository/emulator-windows-4848055.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/emulator-windows-4848055.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Android Emulator: Cannot download 'https://dl.google.com/android/repository/emulator-windows-4848055.zip': Read timed out, response: 200 OK."Install Android Emulator (revision: 27.3.8)" failed.Preparing "Install Google Repository (revision: 58)".Downloading https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Google Repository: Cannot download 'https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip': Read timed out, response: 200 OK."Install Google Repository (revision: 58)" failed.Preparing "Install Android SDK Build-Tools 28.0.1 (revision: 28.0.1)".Downloading https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Build-Tools 28.0.1: Cannot download 'https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zip': SSL peer shut down incorrectly, response: 200 OK."Install Android SDK Build-Tools 28.0.1 (revision: 28.0.1)" failed.Preparing "Install Android SDK Platform 28 (revision: 4)".Downloading https://dl.google.com/android/repository/platform-28_r04.zipjava.io.IOException: Cannot download 'https://dl.google.com/android/repository/platform-28_r04.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Platform 28: Cannot download 'https://dl.google.com/android/repository/platform-28_r04.zip': SSL peer shut down incorrectly, response: 200 OK."Install Android SDK Platform 28 (revision: 4)" failed.Parsing D:\Android\sdk\platform-tools\package.xmljava.io.IOException: Cannot download 'https://dl.google.com/android/repository/android_m2repository_r47.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android Support Repository: Cannot download 'https://dl.google.com/android/repository/android_m2repository_r47.zip': SSL peer shut down incorrectly, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Tools: Cannot download 'https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip': Read timed out, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bak': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package SDK Patch Applier v4: Cannot download 'https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bak': Read timed out, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/emulator-windows-4848055.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Android Emulator: Cannot download 'https://dl.google.com/android/repository/emulator-windows-4848055.zip': Read timed out, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip': Read timed out, response: 200 OKWarning: An error occurred while preparing SDK package Google Repository: Cannot download 'https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip': Read timed out, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Build-Tools 28.0.1: Cannot download 'https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zip': SSL peer shut down incorrectly, response: 200 OK.java.io.IOException: Cannot download 'https://dl.google.com/android/repository/platform-28_r04.zip': SSL peer shut down incorrectly, response: 200 OKWarning: An error occurred while preparing SDK package Android SDK Platform 28: Cannot download 'https://dl.google.com/android/repository/platform-28_r04.zip': SSL peer shut down incorrectly, response: 200 OK.~
因此手動(dòng)通過迅雷下載如下安裝包:
https://dl.google.com/android/repository/platform-tools_r28.0.0-windows.zip
https://dl.google.com/android/repository/platform-28_r04.zip
https://dl.google.com/android/repository/build-tools_r28.0.1-windows.zip
https://dl.google.com/android/repository/google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip
https://dl.google.com/android/repository/emulator-windows-4848055.zip
https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip.bak
https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip
https://dl.google.com/android/repository/android_m2repository_r47.zip
下載完成后逐個(gè)解壓縮放入SDK目錄,如下:
1榨了、創(chuàng)建SDK目錄煎谍,并copy上述文件到sdk目錄
2、platform-tools_r28.0.0-windows.zip直接接受壓縮到本地目錄:Sdk\build-tools
3龙屉、platform-28_r04.zip解壓縮后得到android-9文件夾呐粘,把a(bǔ)ndroid-9修改為android-28,放到本地目錄:Sdk\platforms\android-28
4转捕、build-tools_r28.0.1-windows.zip解壓縮后得到android-9文件夾作岖,把a(bǔ)ndroid-9修改為28.0.1,放到本地目錄:Sdk\build-tools\28.0.1
5五芝、google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip解壓縮后得到m2repository文件夾痘儡,放到本地目錄:Sdk\extras\google\m2repository
6、emulator-windows-4848055.zip解壓縮后得到emulator文件夾枢步,放到本地目錄:Sdk\emulator
7沉删、3534162-studio.sdk-patcher.zip.bak修改名稱為3534162-studio.sdk-patcher.zip渐尿,解壓縮后得到sdk-patcher,修改名稱為patcher放到本地目錄:Sdk\patcher\v4
8矾瑰、sdk-tools-windows-4333796.zip解壓縮后得到tools文件夾砖茸,放到本地目錄:Sdk\tools
9、android_m2repository_r47.zip解壓縮后得到m2repository殴穴,放到本地目錄:Sdk\extras\android\m2repository
上述完成后重新啟動(dòng)Android Studio凉夯,創(chuàng)建項(xiàng)目時(shí)選擇sdk指定到本地Sdk目錄。Android Studio檢查Sdk目錄的文件并顯示成功采幌。
創(chuàng)建android app時(shí)劲够,如果需要下載安裝https://dl.google.com/android/repository/aiasdk-1.3.0-1525823131.zip,也可以使用類似方式植榕,通過迅雷下載aiasdk-1.3.0-1525823131.zip包,然后解壓縮得到sdk文件夾尼夺,修改sdk名稱為instantapps尊残,放到本地目錄:Sdk\extras\google\instantapps