Android Studio 3.0.1 Gradle sync失败:原因:org.gradle.util.GFileUtils.unpack(Ljava / lang / Object;)Ljava / lang / Object;

时间:2018-02-10 00:51:40

标签: java android android-studio gradle ide

我的Android工作室在gradle中存在问题。   我打开我的gradle到离线工作。为了得到我选择的gradle版本......

我试图改变我的



distributionUrl=https\://services.gradle.org/distributions/gradle-4.1.zip






distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-rc-5.zip




之后它开始刷新我的android工作空间,现在它终于完成了,它给了我一个错误



Gradle sync failed: Cause: org.gradle.util.GFileUtils.unpack(Ljava/lang/Object;)Ljava/lang/Object;
				Consult IDE log for more details (Help | Show Log) (10s 384ms)






Error:Unable to find method 'org.gradle.util.GFileUtils.unpack(Ljava/lang/Object;)Ljava/lang/Object;'.

Possible causes for this unexpected error include:

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.




我尝试过上述方法,其中任何一种方法都无效

gradle-wrapper.properties



#Sun Nov 26 15:02:51 PST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-rc-5.zip




Gradle.properties



# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true




的build.gradle



// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.4-rc-5'
        

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}




Settings.gradle



include ':app'




1 个答案:

答案 0 :(得分:0)

我知道这是我自己的问题,我做了这个,但现在我完全弄明白如何解决这个问题。

[确保您的互联网连接正常!]

  • 关闭项目
  • 转到设置> Gradle>取消勾选离线mod
  • 不要选择任何支持(例如C ++)
  • 构建Gradle信息时转到文件>设置>构建,执行,部署>摇篮
  • 选择本地gradle分发
  • 选择放置提取的gradle的路径文件夹
  • (例如C:/ Program Files / Android / Android Studio / gradle / gradle-4.4-rc-5)
  • 然后申请

它对我很好,现在,我的Android Studio重新下载了一些依赖项。