I was recently working with a customer trying to install Visual Studio 2015 in their corporate network which happened to be behind a firewall. Access to the internet was restricted and provided with a proxy server that would allow some requests through the firewall. When they tried to install Visual Studio 2015 on a developer desktop with the proxy configured correctly they were still seeing install failures.
The install failures showing in the UI were all the Android SDK API Levels. These are installed for Cordova and Xamarin cross platform mobile development scenarios.
Looking deeper into the logs we would find errors like the following:
DownloadManager Error: 0 : Install return code for product 'Android SDK Setup (API Level 22)' is Failure (The following package(s) were not downloaded: build-tools-22.0.1 android-22 . Please check your internet connection and try again.) DownloadManager Information: 0 : Product Android SDK Setup (API Level 22) done install completed DownloadManager Information: 0 : Increasing current install to 2 DownloadManager Information: 0 : Using execute progress heuristic for: Android SDK Setup (API Level 23) DownloadManager Error: 0 : Install return code for product 'Android SDK Setup (API Level 23)' is Failure (The following package(s) were not downloaded: build-tools-23.0.1 android-23 . Please check your internet connection and try again.) DownloadManager Information: 0 : Product Android SDK Setup (API Level 23) done install completed DownloadManager Information: 0 : Increasing current install to 3 DownloadManager Information: 0 : Using execute progress heuristic for: Android SDK Setup (API Level 19 and 21) DownloadManager Error: 0 : Install return code for product 'Android SDK Setup (API Level 19 and 21)' is Failure (The following package(s) were not downloaded: platform-tools extra-android-support extra-android-m2repository build-tools-19.1.0 build-tools-21.1.2 android-19 android-21 sys-img-armeabi-v7a-android-19 sys-img-x86-android-19 addon-google_apis-google-19 . Please check your internet connection and try again.) DownloadManager Information: 0 : Product Android SDK Setup (API Level 19 and 21) done install completed
It turns out the root cause of this issue is that the Android SDK Package Manager doesn’t look to the machine-wide proxy settings when accessing the internet. The Android SDK Package Manager stores it’s own proxy configuration instead. Visual Studio is able to install the package manager, but the package manager can’t install any of the API levels because it doesn’t have the proxy information to access the internet through the secure firewall.
As it turns out there’s an easy fix for this issue! We just need to help the Android SDK Package Manager with the proxy settings! The package manager stores it’s proxy settings in a specific file in the user profile so we can put this file with the correct settings before installing Visual Studio and everything should work.
Here are the steps to fix this issue!
- BEFORE installing Visual Studio, create a file at this location: %USERPROFILE%\.android\androidtool.cfg
- In the androidtool.cfg file that you just created, place the following contents. Make sure to update “http.proxyPort” and “http.proxyHost” in the file!
- Install Visual Studio normally
Anyway, I hope that’s useful! Post a comment below if this helped!