官网下载Android Studio安装包后安装启动Android Studio,程序提示安装SDK,因为代理/翻墙的原因,安装component失败,错误如下:
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:Androidsdkplatform-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:Androidsdkplatform-toolspackage.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.~
因此手动通过迅雷下载如下安装包:
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
下载完成后逐个解压缩放入SDK目录,如下:
1、创建SDK目录,并copy上述文件到sdk目录
2、platform-tools_r28.0.0-windows.zip直接接受压缩到本地目录:Sdkuild-tools
3、platform-28_r04.zip解压缩后得到android-9文件夹,把android-9修改为android-28,放到本地目录:Sdkplatformsandroid-28
4、build-tools_r28.0.1-windows.zip解压缩后得到android-9文件夹,把android-9修改为28.0.1,放到本地目录:Sdkuild-tools28.0.1
5、google_m2repository_gms_v11_3_rc05_wear_2_0_5.zip解压缩后得到m2repository文件夹,放到本地目录:Sdkextrasgooglem2repository
6、emulator-windows-4848055.zip解压缩后得到emulator文件夹,放到本地目录:Sdkemulator
7、3534162-studio.sdk-patcher.zip.bak修改名称为3534162-studio.sdk-patcher.zip,解压缩后得到sdk-patcher,修改名称为patcher放到本地目录:Sdkpatcherv4
8、sdk-tools-windows-4333796.zip解压缩后得到tools文件夹,放到本地目录:Sdk ools
9、android_m2repository_r47.zip解压缩后得到m2repository,放到本地目录:Sdkextrasandroidm2repository
上述完成后重新启动Android Studio,创建项目时选择sdk指定到本地Sdk目录。Android Studio检查Sdk目录的文件并显示成功。
创建android app时,如果需要下载安装https://dl.google.com/android/repository/aiasdk-1.3.0-1525823131.zip,也可以使用类似方式,通过迅雷下载aiasdk-1.3.0-1525823131.zip包,然后解压缩得到sdk文件夹,修改sdk名称为instantapps,放到本地目录:Sdkextrasgoogleinstantapps