4

I Installed android studio with all requirements for flutter, when I run flutter doctor everything is fine and installed correctly. I created a normal android project and it's running fine with no errors. Now after I created new flutter project I get this error whenever I run the project. I couldn't solve it.

Launching lib\main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Finished with error: ProcessException: Process "C:\Users\Nesma\AndroidStudioProjects\flutter_app\flutter_apptest\android\gradlew.bat" exited abnormally: Downloading https://services.gradle.org/distributions/gradle-4.10.2-all.zip

Exception in thread "main" java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Too many open connections"
    at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2142)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
    at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2729)
    at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2641)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1824)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
    at org.gradle.wrapper.Download.download(Download.java:44)
    at org.gradle.wrapper.Install$1.call(Install.java:61)
    at org.gradle.wrapper.Install$1.call(Install.java:48)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
  Command: C:\Users\Nesma\AndroidStudioProjects\flutter_app\flutter_apptest\android\gradlew.bat -v
1
  • seems like there is a problem with network connection. Commented Sep 1, 2019 at 11:52

2 Answers 2

1

The problem is because you don't have the gradle-4.10.2-all version and when you run it is trying to download it without success.

If you already created another project with gradle, you can check the versions you have in: C:\Users\{USERNAME}\.gradle\wrapper\dists\ and modify the gradle configuration of your new project.

Sign up to request clarification or add additional context in comments.

6 Comments

I downloaded the required gradle version manually and unzipped it in the path you mentioned but still get the same error
Copy to .gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv/ use the same path for this version of gradle :)
I already copied it to that directory. but still having the same error. How can I make the project identify this version which I downloaded and copied ?
Modify the file yourproject/gradle/wrapper/gradle-wrapper.properties according to your gradle version. The line distributionUrl=https\://services.gradle.org/distributions/gradle-4.x.x-all.zip
sorry. I'm still having the same issue. That did not solve the issue
|
1

I solved this problem by doing two things:

  • downgrading (but maybe you have to upgrade) value for gradle. Go to android\gradle\wrapper\gradle-wrapper.properties and change value for distributionUrl. In my case - from 5.6.2 to 5.4.1
  • setting up proxy settings (because I have corporate firewall). Go to android\gradle.properties and add something like this. If you need to add user, google it
    systemProp.http.proxyHost=somehost
    systemProp.http.proxyPort=port
    systemProp.https.proxyHost=somehost
    systemProp.https.proxyPort=port

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.