When you create a new Android Gradle project in Android Studio, connect Refused:connect or stuck in building project ... or refreshing

Source: Internet
Author: User

When you create a new Android Gradle project in Android Studio, connect Refused:connect or stuck in building project ... or refreshing XXX Gradle project
===
The reasons are:
Gradle in the creation of the need for networking, otherwise it will fail, although I can network, but cannot access the Gradle site or download, so no.
Thanks to the great gfw, two ways of

1.Using proxies
---
Turn over the wall, you can.
- Start XX Gate
- HTTP proxy, manual proxy, setting, Android Studio, configration Select HTTP
```
hostname:127.0.0.1
Port number:8580
```
Port number depends on local port setting of XX Gate
- Restart as when Setup is complete, re-sync project with Gradle files

* * Advantages: * *The other functions that need to be turned over to the wall can also be used
* * Cons: * *It's a little tricky to configure.

2.Using Gradle offline Packages
---
When you create a new project, you can see
```
Refreshing xxx gradle project
gradle Download Http://services.gradle.org/distributions/gradle-1.12-all.zip
```
That is, stuck in the Gradle installation package download, then we put the offline package down, put it in the right place is good
- The right location and the right version
gradle Download Locations for each operating system
> Windows:c:\documents and Settings\<user name>\.gradle\wrapper\dists\

> linux:~/.gradle/wrapper/dists/

> mac:~/.gradle/wrapper/dists/

version
Although the download of as is stuck, a storage directory such as \gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo has been created in the Dist directory. From the front can also be seen to download the offline package is Gradle-1.12-all.zip
- Download, put Gradle-1.12-all.zip under \gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo, restart as, reopen project
* * Advantages: * *Do not configure each new Gradle project again
* * Cons: * *Gradle storage directory in the system directory, the reload system may have to be reconfigured

3.Using Gradle Offline package (ii)
---
Offline packages can also be placed in a custom directory, such as I put under the D:\DevEnv\gradle, and then
- Select Use local Gradle distribution in Project-level Settings, Gradle-Settings,
- Fill in the custom storage directory in Gradle home.
- Restart as to reopen the project

* * Advantages: * *Custom storage directory for easy management
* * Cons: * *Because it is project-level settings, each new Gradle project must be configured once

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.