有了一个空白的新项目,我得到了这个:
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
在尝试构建时,我得到以下Gradle Build错误:
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
这是Android Studio的全新安装,我的build.gradle看起来像:
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() } }
相关日志错误的第一行是:
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
项目结构只是具有空白活动的新项目的默认值:
解决方法
对我来说,它看起来像不兼容的版本.所以这个问题与这个问题有关:
Android Studio says to use Gradle 1.10 – but new version is 1.12?