How to Setup gradle-2.2.1-all.zip Manually

In your command you're using the Gradle Wrapper. The Gradle wrapper is a thin wrapper around the real Gradle bin. It's intended to be checked in to your source control and it then downloads the version of Gradle you've defined in gradle/wrapper/gradle-wrapper.properties. The advantage here is the version of Gradle used in the build is directly tied to the source control.

You have 2 options:

  • use the gradle command instead of gradlew - this will use the gradle that's installed on the local machine (assumes that 'gradle' is on the PATH). The drawback here is you have to have installed Gradle somewhere before the build will work.
  • change distributionUrl in gradle/wrapper/gradle-wrapper.properties to point to a different URL and host that file yourself somewhere. You get all the advantages of the wrapper but fix the problems you're having downloading it.

Solution :

1). Delete the C:\Users\username\.gradle folder

2). Download http://downloads.gradle.org/distributions/gradle-2.2.1-all.zip

3). Create a new project in android studio.

4). When this time it stucks at gradle building, Force close the android studio.

5) Now go to C:\Users\username\.gradle\wrapper\dists\gradle-2.2.1-all\c64ydeuardnfqctvr1gm30w53 (the end directory name may be different)

6) Delete gradle-2.2.1-all.zip.lck and other files from this directory.

7) Paste the new downloaded gradle-2.2.1-all.zip here.

8) Run the android studio. :)