John Won
John Won

Reputation: 65

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 --infobut 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.

Upvotes: 5

Views: 5962

Answers (3)

Wellington Souza
Wellington Souza

Reputation: 2358

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

Upvotes: 0

Adam Adamaszek
Adam Adamaszek

Reputation: 4044

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.

Upvotes: 2

johnrao07
johnrao07

Reputation: 6908

If nothing seems to work, then do this

Just delete your .gradle folder

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

Upvotes: 3

Related Questions