Skip to content

Configure Proxy settings for Android builds #2816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
teobugslayer opened this issue May 16, 2017 · 2 comments
Closed

Configure Proxy settings for Android builds #2816

teobugslayer opened this issue May 16, 2017 · 2 comments
Assignees
Milestone

Comments

@teobugslayer
Copy link
Contributor

teobugslayer commented May 16, 2017

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.

@petekanev
Copy link
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

@teobugslayer
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants