4

With a blank new project, I get this:

Gradle 'HelloWorld' project refresh failed
    Error:Cause: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V

When trying to build I get the following Gradle Build error:

Error:A problem occurred configuring root project 'HelloWorld'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:0.12.+.
     Required by:
         :HelloWorld:unspecified
      > org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V

This is a fresh installation of Android Studio, and my build.gradle looks like:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

The first lines of the relevant log error are:

org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.12-all.zip'.
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'HelloWorld'.
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'HelloWorld'.
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':classpath'.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:0.12.+.
Caused by: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V

The project structure is just the default for a new project with a blank activity:

Project structure screenshot

alexdavey
  • 672
  • 1
  • 9
  • 15
  • can you show use a screenshot of your project structure? – StuStirling Jul 16 '14 at 17:41
  • @DiscoS2 The project structure is the default for a new project with a blank activity, so that shouldn't be a problem, but I have uploaded a screenshot as requested – alexdavey Jul 16 '14 at 18:20
  • did you try a refresh install? http://stackoverflow.com/questions/17625622/how-to-completely-uninstall-android-studio/18458893#18458893 – Simon Jul 23 '14 at 14:06

2 Answers2

4

For me it look like incompatible versions. So this problem is related to this problem: Android Studio says to use Gradle 1.10 - but new version is 1.12?

Try to use gradle 1.10 and delete the the folder of the gradle wrapper.

Community
  • 1
  • 1
The End
  • 709
  • 3
  • 18
  • This answer might help too upgrading your Gradle version: http://stackoverflow.com/questions/22252956/android-studio-gradle-issue-upgrading-to-version-0-5-0-gradle-migrating-from-0/22252957#22252957 – Cedric Simon Jul 25 '14 at 23:02
-1

Try mavenCentral() instead of jcenter()

Looks like this is a known issue.. https://code.google.com/p/android/issues/detail?id=73511

San
  • 5,567
  • 2
  • 26
  • 28
  • Unfortunately this does not seem to fix the issue. – alexdavey Jul 16 '14 at 19:44
  • Then it should be something related to gradle wrapper. It is worth checking this http://stackoverflow.com/questions/18673636/gradle-error-could-not-execute-build-using-gradle-distribution – San Jul 16 '14 at 20:03
  • I have tried all of the solutions listed on that page, and none of them have worked. – alexdavey Jul 16 '14 at 23:36