Connect refused: connect when creating an android gradle project in android studio, or be stuck in the building project... or Refreshing
Connect refused: connect when creating an android gradle project in android studio, or be stuck in the building project... or Refreshing xxx gradle project
===
The reason is:
Gradle must be connected to the Internet when it is created. Otherwise, it will fail. Although I can connect to the Internet, I cannot access or download the gradle website, so I cannot.
Thanks for the great GFW, two methods
1. Use proxy
---
You can turn over the wall.
-Start XX Portal
-Android studio-> setting-> http proxy-> manual proxy configration select http
'''
HostName: 127.0.0.1
Port Number: 8580
'''
The port number depends on the local port settings of the XX gate.
-Restart the as after setting and Re-sync the project with gradle files
** Advantages: ** other as functions that require Wall Flip can also be used.
** Disadvantages: ** configuration is troublesome.
2. Use the gradle offline package
---
When creating a project, you can see
'''
Refreshing xxx gradle project
Gradle download http://services.gradle.org/distributions/gradle-1.12-all.zip
'''
That is, it is stuck in the gradle installation package download, so we can put the offline package down and put it in the correct position.
-Correct location and version
Gradle download location for each Operating System
> Windows: C: \ Documents ents and Settings \ \. Gradle \ wrapper \ dists \
> Linux :~ /. Gradle/wrapper/dists/
> Mac :~ /. Gradle/wrapper/dists/
Version
Although the as download is stuck, but in the dist directory has created \ gradle-1.12-all \ Contents
-Download, put gradle-1.12-all.zip under \ gradle-1.12-all \ 2apkk7d25miau1_1pdjp1bm0uo, restart as, re-open the project
** Advantage: ** you do not need to configure it once every time you create a gradle project.
** Disadvantages: ** the gradle directory is stored in the system directory. You may need to reconfigure the system for reinstallation.
3. Use the gradle offline package (2)
---
The offline package can also be placed in a custom directory, for example, under D: \ DevEnv \ gradle, and then
-Choose Use local Gradle distribution from Settings> gradle> Project-level settings,
-Enter the custom storage directory in gradle home.
-Restart as and re-open the project.
** Advantages: ** custom storage directory for ease of Management
** Disadvantages: ** because it is a Project-level settings, you must configure it once each time you create a gradle Project.