Ubuntu下SDK包安装失败及Android Studio SDK下载超时问题求助
Hey, I've run into this exact timeout issue when installing Android SDK packages on Ubuntu before—let me walk you through the fixes that worked for me and other devs:
1. 手动下载并放置SDK包
The root problem here is that the large zip file times out during automatic download. Instead, grab it manually:
- Open your terminal and run this command to download the package directly:
Or use your browser to download it if you prefer—just make sure the download completes fully (no corrupted files).wget https://dl.google.com/android/repository/android_m2repository_r47.zip - Next, find your SDK location in Android Studio: go to
File > Settings > Appearance & Behavior > System Settings > Android SDKto get the path. - Navigate to the
tempfolder inside your SDK directory (create it if it doesn't exist) and move the downloaded zip there. Alternatively, extract the zip and copy all its contents toextras/android/m2repository(create this directory structure if it's missing).
2. 调整Android Studio的超时与网络设置
Sometimes the default timeout is too short for large files, or IPv6 causes connectivity glitches:
- Open
Help > Edit Custom VM Optionsin Android Studio. Add these lines to the file:
The first line forces IPv4 (avoids IPv6-related drops), and the next two increase the timeout to 100 seconds (adjust if needed).-Djava.net.preferIPv4Stack=true -Dhttp.connection.timeout=100000 -Dhttp.socket.timeout=100000 - Save the file and restart Android Studio, then try installing the SDK again.
3. 检查代理配置
If you're on a network that uses a proxy, double-check your settings:
- Go to
File > Settings > Appearance & Behavior > System Settings > HTTP Proxy. - If you need a proxy, select the correct type (HTTP/HTTPS) and enter the correct address/port, then click
Check connectionto verify it works. - If you don't use a proxy, make sure
No proxyis selected, and clear any old proxy cache.
4. 切换到国内镜像源(针对国内开发者)
If you're in a region where Google's servers are slow, try a domestic mirror:
- In SDK Manager, go to the
SDK Update Sitestab. - Click the
+button to add a mirror likehttp://mirrors.aliyun.com/android/repository/, then uncheck the original Google repositories. - Refresh the package list and try installing again—just ensure the mirror has the
android_m2repository_r47.zippackage available.
If none of these work, try restarting your router or waiting a bit—sometimes it's just a temporary network blip causing the timeout.
内容的提问来源于stack exchange,提问作者benyamin nadri

