13

I've downloaded and installed Android Studio with all the required dependencies such as JDK 1.7 and Gradle 1.6. I am able to import the projects and modules quite comfortably in Studio, but when I try to create a new project I am getting errors like this:

Image

Since this is the new born IDE I couldn't find much details on this, except for this and this. Any help would be greatly appreciated.

MasterScrat
  • 7,090
  • 14
  • 48
  • 80
KunalK
  • 1,904
  • 4
  • 22
  • 40
  • possible duplicate of [Failed to import new Gradle project in android studio](http://stackoverflow.com/questions/16586674/failed-to-import-new-gradle-project-in-android-studio) – Gaurav Agarwal Jul 17 '13 at 21:02

9 Answers9

16

After to pass much time trying to resolve this, i reached a solution :

Are you using "Windows Version" of AS ?

Please follow these steps :

1 - Install the last version of JDK with respective JAVA_HOME variable.

2 - Download and Install Gradle1.6 with respective GRADLE_HOME variable,

http://www.gradle.org/docs/current/userguide/userguide_single.html#installation.

2 - Delete these folders:

    C:\Users\youruser\.AndroidStudioPreview
    C:\Users\youruser\.android
    C:\Users\youruser\.gradle

3 - Reopen Android Studio

Now probably it will works

There are a lot of bugs in "Early Access Preview"....

natanaelfonseca
  • 321
  • 1
  • 6
  • Looks like the latest patch did not work too. Thanks for the work around. – Keshi Jun 13 '13 at 18:54
  • Tried this, but it didn't work for me. I don't have the exact same situation though I do have the same "Could not fetch model of type 'IdeaProject' using Gradle installation" with gradle 1.6. This is with a project I created in Android Studio. – Akh Jul 06 '13 at 15:43
  • 4
    Surely deleting .android is a bad idea since this is where all your emulator profiles are? – Ian Warwick Jul 22 '13 at 11:04
  • I up voted this one too soon, ended up running into the error after all :( – StrikeForceZero Sep 18 '13 at 12:26
2

The error dialog mentions Gradle 1.4

Android Studio requires the Gradle plugin 0.4 which requires Gradle 1.6

Xavier Ducrohet
  • 28,383
  • 5
  • 88
  • 64
  • Ok. i've found the solution here. rather than downloading and unzipping the gradle package manually, i've leave it on android-studio. so when you create a new project for the very first time after installing android-studio, it will automatically download all the gradle dependency and install it for you. so you don't need to worry about it. – KunalK May 21 '13 at 10:34
1

I tried the environment variable and folder location stuff suggested, also 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.

Hamish McNeill
  • 397
  • 2
  • 8
1

For me, this problem was caused by my local.properties file showing a different path to the Android SDK. I do development on both Mac OS X and Windows and the properties file was showing my Mac OS X SDK path. Turns out, this file shouldnt even be checked into source control. Ooops!

Kilhoffer
  • 32,375
  • 22
  • 97
  • 124
1

The best solution I found is to check-out some empty project, then import it rather than use the "New project" utility.

MasterScrat
  • 7,090
  • 14
  • 48
  • 80
1

The fix for me was on the Known Issues page here: http://tools.android.com/knownissues

I changed

dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }

to:

dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }

Reopened Android Studio and voila!

shanabus
  • 12,989
  • 6
  • 52
  • 78
0

I fixed the problem by downloading a fresh copy of AndroidStudio. During one of the updates something went wrong so I delete all config files and freshly downloaded the file from the Internet and then it worked fine for me.

(I'm on a Mac)

hashier
  • 4,670
  • 1
  • 28
  • 41
0

If you are still receiving this error when creating a new project, then try opening the project (after error) and removing the following from your build.gradle file in your module.

dependencies {
compile 'com.android.support:support-v4:13.0.+'
}
jdalgety
  • 11
  • 1
0

I resolved this by installing some extras from Android SDK what I did not think I needed: Google Repository and Google Play services. In addition of Android Support Repository.

When manually running gradle you get more meaningful error messages.

user1497298
  • 121
  • 5