35

I got the error when i create a new Project using android studio. below i attached a screenshots of error message..enter image description here I am using windows 7 (64 bit) Please help me.

Hardik Nadiyapara
  • 2,436
  • 2
  • 17
  • 24
  • 1
    go to File --> Settings --> click option-->Gradle location.go to Gradle download site, then download a local distribution of Gradle and check the Gradle location t dat directory. – Sam May 16 '13 at 12:00
  • but i create a new project – Hardik Nadiyapara May 16 '13 at 12:14
  • possible duplicate of [Could not fetch model of type 'IdeaProject' using Gradle installation](http://stackoverflow.com/questions/16609666/could-not-fetch-model-of-type-ideaproject-using-gradle-installation) – Eng.Fouad Jul 20 '13 at 05:41
  • @siddharth lele and Eng.Fouad please see the asked question date – Hardik Nadiyapara Jul 23 '13 at 05:09
  • @HardikNadiyapara: And you are telling that to me because?? I haven't marked it as a duplicate. I merely added a tag to your question mate!! – Siddharth Lele Jul 23 '13 at 05:17
  • @Siddharth Lele if i asked a question one day before then what is the requirement of editing it?? – Hardik Nadiyapara Jul 23 '13 at 06:50
  • @HardikNadiyapara: And how did me adding the tag affect your question? Besides adding a little clarity to what the question stands for! That is the whole point of tags isn't it? The chronology of your question has **absolutely** nothing to do with tags! And if you feel differently you might consider reading [What are tags, and how should I use them?](http://stackoverflow.com/help/tagging) – Siddharth Lele Jul 23 '13 at 06:55
  • Mine had this same error but had a 'not enough memory' error within it I added "-XX:MaxHeapSize=256m" to the JVM options in the project creation config (last step) and this fixed it –  Aug 23 '13 at 09:54

11 Answers11

32

I also had an issue downloading gradle through AndroidStudio. I tried the following.

  1. Go to your AndroidStudio directory where you installed your studio Like D:\User\AndroidStudio
  2. In AndroidStudio go to \AndroidStudio\plugins\gradle\lib and copy gradle.jar
  3. Paste gradle.jar file in \AndroidStudio\lib directory.
  4. Download gradle directly from Gradle
  5. Copy the contents of gradle-1.6-bin.zip - After extracting zip file - (bin, media, init.d, lib folders) to \AndroidStudio\plugins\gradle
  6. Restart AndroidStudio

* Updated Answer *

And after following all the steps listed above, if it is not working, Kindly check below things.

1) Please delete .gradle folder from your user like C:\Document and Settings\AndroidUser\***\.gradle

2) You can check your HTTP Proxy in Settings.

Hope this helps!

Darrell
  • 638
  • 4
  • 17
  • 14
    after completion of step provided by you, i create new project and it throws an error "org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings" – Hardik Nadiyapara May 18 '13 at 07:27
  • 6
    @Hardik Nadiyapara, I had the same problem as you after following these instructions. After deleting gradle.jar from \AndroidStudio\lib (the one you pasted in step 3) it works. – Rotem May 19 '13 at 08:19
  • @HardikNadiyapara As `AndroidStudio` is in early preview access version, you can do two things 1) Please delete `.gradle` folder from your user like `C:\Document and Settings\AndroidUser\***\.gradle` or 2) You can check your `HTTP Proxy Settings`. –  May 20 '13 at 03:57
  • @Abhan Thanks it help me a lot.and one more things can you edit you answer for helping others.. – Hardik Nadiyapara May 20 '13 at 07:01
  • @Rotem if I delete the .jar file from \AndroidStudio\lib, when I open AndroidStudio it tells me that I have no gradle plugin installed and other plugins may not work (for dependecies reason), and I can see only Maven as option for the import... – Santacrab May 20 '13 at 09:51
  • Also be sure that you don't have a GRADLE_HOME environment variable set to another (older) installation of gradle. This will cause all kinds of errors. – Streets Of Boston Jun 06 '13 at 16:13
  • I did the steps above but I am still receiving the same error as @HardikNadiyapara – Si8 Jul 19 '13 at 20:27
  • 1
    @SiKni8 Hi, Google recently released newer version of Android Studio with some bug fixes. You can download that one. Thanks. –  Jul 20 '13 at 15:29
  • It was just too much for configuration and although setting up Eclipse takes twice as long but the process is much simpler. Until AS get out of Early Preview build, I will stick to Eclipse. Thanks @Abhan – Si8 Jul 21 '13 at 13:05
  • @SiKni8 You should follow this answer http://stackoverflow.com/a/17612960/1235074 – Davuz Jul 31 '13 at 04:49
  • 2
    Nope! Made things more ugly and worse. This IDE is assigned for the biggest and most epic fail I have ever seen. – Martin Pfeffer Aug 08 '14 at 00:27
  • @MartinPfeffer They are fixing bugs with each release. You should always tuned with the latest. I used it earlier and after that so many versions are released. –  Sep 17 '14 at 14:48
28

In my case, it was sufficient to specify the location of the Gradle distribution included with Android Studio when requested.

On a mac, it was: /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1
On Linux, it can be generalized to {android-studio-root}/grade/gradle-{version}

MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
Tad
  • 4,668
  • 34
  • 35
10
  1. First Create a New Project "your_project"
  2. When the above stated error appears click ok
  3. Now go to IMPORT-> "your_project " and follow the instruction
  4. Your Project Is Created
Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
Vivek Mishra
  • 350
  • 2
  • 12
4

Download gradle, and replace it with the file gradle-1.6-bin.zip located at: C:\Users\<username>\.gradle\wrapper\dists\gradle-1.6-bin\<some_hash_key>\

Muhammad Hewedy
  • 29,102
  • 44
  • 127
  • 219
2

If Android Studio offers you to choose home folder for gradle, just choose "Use customizable gradle". Then, if you see only gradle files, but no classes and resources - click on "Synchronize gradle" and it will be alrigth. Hope this helps

Alex Perevozchykov
  • 2,211
  • 22
  • 19
1

For me, this issue only occurs when using a proxy server. If you specify a proxy server in the settings, everything is working fine for me. You can specify a proxy server by File->Settings->HTTP Proxy

TomS
  • 467
  • 9
  • 25
1

If you using ubuntu behind a proxy, in my case I'm using ctlm, you must change the jetbrains' proxy setting in /Home/UserName/.AndroidStudioPreview/config/options/other.xml

<option name="USE_HTTP_PROXY" value="true" />
<option name="PROXY_HOST" value="localhost" />
<option name="PROXY_PORT" value="8080" />

This is my configuration I don't need autentificated user.

bests Regards

1

Had the same problem I think because our internet set-up blocked access to https://dl-ssl.google.com site.I resolved in by downloading gradle 1.6 zip then extracted it in some folder.go to File --> Settings --> click option-->Gradle ,the check use local gradle distribution and point it to the extracted directory eg C:\android-studio\plugins\gradle\gradle-1.6-bin\gradle-1.6 Then it was okay

0

We have to change the android sdk source in the project settings to our sdk where we have installed the android build tools.

I had the same issue and by doing this, it worked. Thanks.

prashanthaku
  • 13
  • 1
  • 3
0

Check your proxy setting for gradle. If it still fails after set the HTTP Proxy in setting menu, you may add gradle.properties as following.

First, go to the project directory. (By default-for Windows-, projects will be created to {user}\AndroidStudioProjects\{ProjectName}). And then create gradle.properties file as below.

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

you can also refer to the User's guide.

Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
rookiejava
  • 114
  • 4
  • I have `gradle-wrapper.jar` and `gradle-wrapper.properties` under the `wrapper` folder. Still not working. – Si8 Jul 19 '13 at 20:30
0

While importing the project I specified the location of the Gradle distribution.

On Windows 7 it was here:

C:\Program Files\Android-Studio\gradle\gradle-2.2.1
Bilbo Baggins
  • 3,644
  • 8
  • 40
  • 64