I am trying to run the react native examples for androind on windows. My system is setup behind a corporate proxy. i am unable to get gradle to work though.
Following proxy settings are defined in the global gradle.properties.
systemProp.http.proxyHost=<proxy.url>
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=<proxy.url>
systemProp.https.proxyPort=8080
I tried running the build from android studio(2.0), same story. My network proxy is properly configured there, i checked, i can access the internet from it.
i changed my build tools to point to the gradle distribution that comes with it, that didn't change anything either.
i keep getting an error saying
"Unknown host <my.proxy.url>. You may need to adjust the proxy settings in gradle"
I also checked, i can download the poms it requires from my browser. it seems as if gradle is unable to work from behind a proxy, at all.
can anyone help?
Related
I'm simply trying to install android studio. Unfortunately my gradle isn't working properly.
The configure build is always failing and throws the error:
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Received status code 407'
I can download the file manually without any problem. (but don't know where to put it so android studio will find it)
I even restarted android studio several times, downloaded gradle locally and put the http proxy on auto detect proxy settings.
The HTTP status code 407 indicates that a proxy authentication is required. Have a look at the documentation on how to do proxy authentication for Gradle as the details really depend on the expected proxy authentication scheme.
I used to run android studio through a proxy, it was called "wall" so I had it configured that way.
I upgraded to Android Studio 3.2 and additionally had to stop using it so I am connected to the internet through a proxy free connection.
I went to my settings->Appearance&Behaviour->System Settings->HTTP Proxy and set the option to No proxy
I search throughout my project for a reference to wall and I couldn't find anything
However when I try to build, gradle tries to download a file ( 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom' ) which I can download normally through my browser and I get the Unknown host 'wall'. You may need to adjust the proxy settings in Gradle.
I tried with a brand new project and get the same.
I tried deleting the C:\Users\(username)\.AndroidStudio3.2 folder and again the same message.
Can someone please provide me with a solution?
After some hours of searching it seems that the problem was that gradle seems to keep a backup of gradle.options (or I may have done it through an option in android studio) in C:\Users\(username)\.gradle\ so even though I removed all references to my proxy, it still kept those and ignored the gradle.properties file in my project.
When I removed the entries to my proxy, it worked fine
In my android studio 3.0 i am continuously getting this error -
Cannot start internal HTTP server. Git integration, JavaScript debugger and LiveEdit may operate with errors. Please check your firewall settings and restart Android Studio.
after this my gradle sync also failed stating the error -
Gradle sync failed: Could not connect to server [a3ea2c7d-cc16-4af2-82a9-037277903c02 port:49555, addresses:[/127.0.0.1]]. Tried addresses: [/127.0.0.1].
One thing to note down that this gradle sync failed when it(gradle) is connecting to gradle daemon.
i have tried all the options from stack overflow like netsh winsock reset etc.
But nothing work for me.
Also to mention i do not use embedded JDK in AS. I have provided it my downloaded jdk8.
How to solve this problem.
Thanks in advance.
Make sure your machine is connected to the internet.
Check the link here: Configure Android Studio - Proxy
I personally recommend that you try disabling the proxy if it is enabled.
Go to Windows Firewall -> Inbound & Outbound Rules -> add java.exe from JDK path & studio.exe from Android Studio directory.
What is it? And what does it do?
I'm working on an enterprise that has a proxy, and it fails trying to connect to somewhere.
Why does it needs internet connection? What ports does it use?
EDIT: The answer of the user Caleb was perfect. I would like to add that the proxy should be configured too in the gradle.properties. Something like this:
systemProp.http.proxyHost=*proxyAddress*
systemProp.http.proxyPort=*portNumber*
systemProp.https.proxyHost=*proxyAddress*
systemProp.https.proxyPort=*portNumber*
What is it? And what does it do?
Gradle sync is a gradle task that looks through all of your dependencies listed in your build.gradle files and tries to download the specified version.
dependencies {
compile '...your dependency...'
}
Why does it needs internet connection? What ports does it use?
It requires an internet connection because it is usually downloading these dependencies from a remote location. You can define what ports it uses by changing your gradle.properties. (see below)
I'm working on an enterprise that has a proxy, and it fails trying to
connect to somewhere.
Your work proxy may be blocking this and you'll need to add your proxy configuration to solve your issues.
Go into:
File-->Settings--> Android Studio Preferences --> Appearance & Behavior / System Settings/ HTTP Proxy
and update your proxy configuration url to your work proxy. (automatic or manual depending on your setup).
NOTE: If you are using the command line to run your gradle build, you will probably need to update the proxy settings via your gradle.properties file.
Global Properties File Location : ~/.gradle/gradle.properties
(or use your local project file if you have one)
Add proxy settings to this file:
HTTPS
systemProp.https.proxyHost=<proxy host>
systemProp.https.proxyPort=<your proxy port>
systemProp.https.nonProxyHosts=<your non-proxy host>
systemProp.https.proxyPassword=<your pw>
HTTP
systemProp.http.proxyHost=<proxy host>
systemProp.http.proxyPort=<your proxy port>
systemProp.http.nonProxyHosts=<your non-proxy host>
systemProp.http.proxyPassword=<your pw>
If you absolutely cannot get an internet connection via gradle you'll need to download the dependencies another way and reference them locally on your computer or local network.
(See this guide for using local jars)
What is it?
I believe it's an IntelliJ/Android Studio term for these Gradle tasks:
dependencies
build
Gradle itself doesn't have "sync" task.
I use the term "believe" since there's no explanation from Gradle/IntelliJ/Android Studio official documentation 😂
And what does it do?
Sync is a phase where the IDE preparing everything, including downloading your dependencies.
When the sync is finished, the user can start coding.
When the sync fails, the IDE is not working properly. The user need to spend time to fix the configuration first.
After Gradle finished syncing, the IDE start another task, like indexing.
Gradle: Build...
Gradle: Configure projects...
Indexing...
I'm working on an enterprise that has a proxy, and it fails trying to connect to somewhere. Why does it needs internet connection? What ports does it use?
Answered above.
Bonus: How to speed up sync
Before opening the project using Android Studio/IntelliJ, open the project using terminal and run the gradle tasks.
cd myproject
./gradlew app:dependencies module:dependencies
./gradlew build
After that, open the project. The sync should be much faster now (since you've downloaded the dependencies in terminal).
It needs internet connection to download dependencies
I've recently shifted to Android-Studio from Eclipse simply because of it's automatic code completion feature which I fell in love with. But Android Studio is giving me a hard time from the moment I installed. It is laggy, it freezes often, but the main problem is that it does NOT build my projects without connecting to the internet. I found this question where I found that we can build gradle projects without connecting it to the internet by enabling the "Offline Mode" but it doesn't work for me. Even if I set gradle to local distribution mode, Android Studio automatically changes it to default settings, which is really annoying. I've no idea what's wrong with Android Studio. I'm using version 0.4.6.
The event log shows this -
11:13:26 PM AssertionError: Already disposed: Already disposed
11:13:42 PM Failed to refresh Gradle project 'Study Buddy'
Unknown host 'repo1.maven.org'.
Please ensure the host name is correct. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
HTTP proxy settings Open Gradle documentation
However, when I connect to the internet gradle builds the projects without any error. But I want to use Android-Studio in Offline Mode since I've a really low bandwidth. Please help to fix this issue.
Offline mode works only after you've compiled one time online. I know, it doesn't make complete sense if you don't understand everything on how Gradle works. But, you have to compile one time online and then it works.
This of course is a moot point if you don't have access to an internet connection at the time you wish to compile. Or, if you're like me, it just doesn't work due to your company's proxy and firewall rules.
I did get it to work at my company but the latest upgrade broke it. And now, even the previous version doesn't work, but I think that was my company as well. They pushed out some "patches" and I think that's what broke it.
You should upgrade. Offline support has improved since 0.4.6; it's mentioned in the 0.5.0 release notes: http://tools.android.com/recent/androidstudio050released