0

I had an issue with Gradle which I have fixed by adding export JAVA_OPTS="-Djava.ext.dirs=" to my .bashrc (also tried adding to .profile and /etc/environment but to no avail)

Gradle now functions correctly and I can build my project from the command line, however if I run Android studio I still get the same issue.. It seems like Android studio is either ignoring (which it explicitly says it doesn't.. the gradle launch script says the user should use JAVA_OPTS to pass arguments) or setting that env variable to "".

For reference the issue (it has to do with conflicting logging Jar being loaded) is:

./gradle 

FAILURE: Build failed with an exception.

* What went wrong:
org.slf4j.impl.Log4jLoggerFactory cannot be cast to org.gradle.logging.internal.slf4j.OutputEventListenerBackedLoggerContext

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  • possible duplicate of Where to declare environment variables? – muru Aug 10 '15 at 8:37
  • Don't add it to .bashrc. Add it to .profile and re-login. – muru Aug 10 '15 at 8:37
  • Tried both .profile and /etc/environment to no avail.. I can successfully run gradle via the command line however Android Studio still fails listing the cause as the aforementioned issue in its log file. There is another workaround here however it is on Mac. When I search my computer for that .jar I have about 20 or so instances of it.. I tried moving the ones in any path which contained 'ext' however the issue is still present. – chaybs Aug 10 '15 at 11:12
  • Did you login again after changing .profile? – muru Aug 10 '15 at 11:23
  • Yep, restarted after both – chaybs Aug 10 '15 at 12:09
0

OK solved it, delete (or better move, in case it breaks something else in the future) the .jars slf4j-log4j12-1.5.8.jar and slf4j-api-1.5.8.jar from /usr/java/packages/lib/ext/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.