【问题标题】:Gradle and Android Studio build failsGradle 和 Android Studio 构建失败
【发布时间】:2018-03-14 06:25:01
【问题描述】:

我一直都能使用 Android Studio。我升级到 Gradle 版本 2.9 并且在构建时不断出错。 我收到以下错误:

Gradle:
FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using 
BuildScopeServices.createScriptObjectConfigurerFactory().

* Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.

我尝试使用 --stacktrace--info 运行它,但似乎没有多大帮助。 我应该把它贴在这里寻求帮助吗?

编辑(我的 --debug 输出):

19:39:58.668 [DEBUG]   
[org.gradle.internal.nativeintegration.services.NativeServices]
Unable to initialize native-platform. 
Failure net.rubygrapefruit.platform.NativeException: Failed to load
native library 'libnative-platform.dylib' for Mac OS X x86_64.
caused by: java.io.FileNotFoundException:
/Users/Johnwon/.gradle/native/19/osx-amd64/libnative- platform.dylib.lock (Permission denied)
19:39:58.718 [DEBUG]  [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Native-platform file system integration is not available. Continuing with fallback.
19:39:58.721 [DEBUG] [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Using UnsupportedSymlink implementation.
19:39:58.723 [DEBUG] [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Using JDK 7 file service org.gradle.internal.nativeintegration.filesystem.jdk7.PosixJdk7FilePermissionHandler
19:39:59.522 [DEBUG] [org.gradle.internal.resource.transport.http.JavaSystemPropertiesProxySettings] Found java system property 'http.nonProxyHosts': local|*.local|169.254/16|*.169.254/16. Will ignore proxy settings for these hosts.

【问题讨论】:

    标签: android android-studio gradle android-gradle-plugin


    【解决方案1】:

    如果似乎没有任何效果,请执行此操作

    只需删除您的 .gradle 文件夹

    位于此处 C:\Users\username.gradle(适用于 Windows

    【讨论】:

    • 我尝试在mac上搜索它,无法弄清楚它的位置...好吧,当您找到它时,请回复评论...我的一个朋友也有类似的问题麦克...
    【解决方案2】:

    就我而言,这是由安装在 64 位机器上的 32 位 JVM 引起的(我使用的是 (jdk-8u92-linux-i586.tar.gz)。

    切换到 x64 JDK 安装 (jdk-8u92-linux-x64.tar.gz) 解决了这个问题。

    【讨论】:

      【解决方案3】:

      在我的情况下,这是由于文件系统中缺少权限引起的。 我只是更改了目录所有者,它就开始工作了:

      sudo chown -fR $(whoami):staff /opt/gradle-4.6
      

      【讨论】:

        猜你喜欢
        • 2013-06-13
        • 2020-10-16
        • 2015-02-06
        • 2016-02-04
        • 1970-01-01
        • 1970-01-01
        • 2021-01-06
        • 1970-01-01
        • 2016-03-31
        相关资源
        最近更新 更多