简体   繁体   中英

Gradle and Android Studio build fails

I've always been able to use Android Studio . I upgraded to Gradle Version 2.9 and I keep getting errors while building. I get the following error:

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.

I've tried running it with --stacktrace and --info but it doesn't seem to help much. Should I post it here to get help?

EDIT(My --debug output):

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.

If nothing seems to work, then do this

Just delete your .gradle folder

Located here C:\\Users\\username.gradle ( for Windows )

In my case, this was caused by a 32-bit JVM installed on a 64-bit machine (I was using (jdk-8u92-linux- i586 .tar.gz).

Switching to a x64 JDK install (jdk-8u92-linux- x64 .tar.gz) fixed the problem.

In my case, it was being caused by lack of permission in the file-system. I just change the directory owner and it starts to work:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM