Setting up the Android Studio Proxy

To support running Android Studio behind a firewall, set the proxy settings for the Android Studio IDE and the SDK Manager. Use the Android Studio IDE HTTP Proxy settings page to set the HTTP proxy settings for Android Studio. The SDK Manager has a separate HTTP Proxy settings page.
Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or secure network. To set the HTTP proxy settings in Android Studio:
  1. From the main menu choose File > Settings > Appearance & Behavior -- System Settings -- HTTP Proxy.
  2. In Android Studio, open the IDE Settings dialog.
    • On Windows and Linux, choose File > Settings > IDE Setting -- HTTP Proxy.
    • On Mac, choose Android Studio > Preferences > IDE Setting -- HTTP Proxy.
    The HTTP Proxy page appears.
  3. Select auto-detection to use an auto-configuration URL to configure the proxy settings or manual to enter each of the settings. For a detailed explanation of these settings, see HTTP Proxy.
  4. Click Apply to enable the proxy settings.
Android Plugin for Gradle HTTP proxy settings
For application-specific HTTP proxy settings, set the proxy settings in the build.gradle file as required for each application module.
apply plugin: 'com.android.application'

android {
    ...

    defaultConfig {
        ...
        systemProp.http.proxyHost=proxy.company.com
        systemProp.http.proxyPort=443
        systemProp.http.proxyUser=userid
        systemProp.http.proxyPassword=password
        systemProp.http.auth.ntlm.domain=domain
    }
    ...
}

Credit: Official Android Website

0 comments:

Post a Comment