微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – Gradle项目刷新失败(AS 0.8.2,Mac)

有了一个空白的新项目,我得到了这个:

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?

尝试使用gradle 1.10并删除gradle包装器的文件夹.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐