Failed to import new Gradle project: Could not fet

2019-01-23 11:59发布

问题:

This question already has an answer here:

  • Failed to import new Gradle project in android studio 11 answers

when i started android studio i get this error:

Failed to import new Gradle project: Could not fetch model of type 'IdeaProject' using    Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at     http://gradle.org/docs/1.6/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Consult IDE log for more details (Help | Show Log)

i use latest android studio and latest(1.6) gradle. whats the problem here? i use 32bit window 8

回答1:

IMPORTANT: I done it on fresh android studio!! if you have plugins and such it may not work for you !

I found the solution that worked for me :

  1. Go to Gradle
  2. Download last version
  3. Open grandle location within Android Studio (in my case is: C:\Program Files (x86)\Android\android-studio\plugins\gradle"
  4. Important: backup your existing Android Studio gradle lib folder (in case things go wrong, as some of the commenters have pointed out)
  5. Open download file from 2.
  6. Override lib folder within Android Studio with lib folder within downloaded file.

Everything should work like a charm :)



回答2:

If you upgrade your Studio to 0.2 version, then to fix this, open the SDK manager, and make sure that the "Extras/Android Support Repository" (not just Android Support Library) is installed.

Source: http://tools.android.com/recent/androidstudio020released



回答3:

Might be a proxy issue, can be solved by adding proxy address.

Studio-->Settings-->HTTP Proxy-->Use Proxy and add proxy details and verify with check connection.



回答4:

Another solution is to install the SDK repository as mentioned in the install notes at the very bottom of the page. This happens after upgrading from android studio 0.1 to 0.2 when creating new projects or implementing existing ones.

  1. Open Android SDK Manager
  2. Install Android SDK Repository from the Extra's tab


回答5:

I made sure I had the latest version of Gradle, but that made no improvement. Then I ran Android Studio using an admin account, at which point all the errors disappeared. If you are able to, I suggest you do the same. This was on a Windows 7 box.



回答6:

I'm on a Mac:

After updating to Version 0.2.0 I had the problem and here is what I did to fix it:

First I removed all old config/settings files:

$ cd
$ find Library/Application\ S* Library/Preference* -iname "*androidstudio*" -exec rm -rf {} +
$ rm -rf .gradle .android

And after this didn't help either I freshly downloaded AndroidStudio. And then it worked. So you might start with a fresh download before removing everything.