Skip to content

Configure Proxy settings for Android builds #2816

Closed

Description

@teobugslayer

Tell us about the problem

At the moment, NativeScript CLI can be configured to work behind a proxy which requires authentication with username/password. However, CLI does not pass the authentication credentials to Gradle and therefore Android builds fail.

Which platform(s) does your issue occur on?

Android, all workstation OSes

Please provide the following version numbers that your issue occurs with:

CLi: 3.0

Please tell us how to recreate the issue in as much detail as possible.

Activity

  1. petekanev commented on May 18, 2017

    @petekanev
    Contributor

    I can confirm that proxy settings are indeed not passed along to the spawned gradle process. I tested a possible solution, and these are my findings:

    • the gradle wrapper process does not respect system properties (-Dhttp.)
    • writing the proxy settings as system properties in either of the two places will make Gradle respect the proxy configuration.
      • /platforms/android/gradle.properties - per project
      • <USER_HOME>/.gradle/gradle.properties - global, 1-time configuration

    Since gradle has a configuration file of its own, I think it should be left to the developer to set it up, just like how they would do with the npm proxy settings.

    These are the settings that should be set in gradle.properties to work with a proxy. The following will set my proxy to work with localhost and a certain port. In case the proxy is configured to require authentication - provide the proxyUser and proxyPassword system properties.

    systemProp.http.proxyHost=127.0.0.1
    systemProp.http.proxyPort=8888
    systemProp.https.proxyHost=127.0.0.1
    systemProp.https.proxyPort=8888
    
    systemProp.http.proxyUser=1
    systemProp.http.proxyPassword=1
    systemProp.https.proxyUser=1
    systemProp.https.proxyPassword=1
    
  2. teobugslayer commented on Jun 16, 2017

    @teobugslayer
    ContributorAuthor

    Can we:

    • (optionally) detect that the gradle configuration files are missing
    • when the users sets the proxy for tns, to print a message instructing them how to set up gradle? this may lead to a docs article.
  3. added this to the 3.2.0 milestone on Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions