Connect refused: connect when creating an android gradle project in android studio, or be stuck in the building project... or Refreshing

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.