Gradle failed to sync on Android Studio on mac

Gradle failed to sync on Android Studio on my mac. I have tried so much but I am not able to overcome this error. It says that it is caused due to:
"
ch.qos.logback.classic.loggercontext cannot be cast to org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext
"
I even tried reinstalling it but it didnt not work. What do I do?

Gradle Version: 3.0
Operating System and JVM version: OS X 10.11 JVM: Version 8
Is this a regression? If yes, which version of Gradle do you know it last worked for?

Hi Ayush,

Can you check if this is the same issue as the one reported here:
https://issues.gradle.org/browse/GRADLE-1451

That is, maybe another tool put conflicting JARs into /Library/Java/Extensions

Try if this helps you: https://issues.gradle.org/browse/GRADLE-1451?focusedCommentId=16164&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16164

how do I export JAVA_OPTS="-Djava.ext.dirs="? thats the solution given. where do i type that code?

You could add this to Android Studio.app/Contents/Info.plist (section <key>VMOptions</key>).

However, I am afraid it still won’t work with the current Studio version that uses the Gralde daemon, which does not get the argument. I am still looking into that, but it’s likely not that easy to solve and I cannot think of a good work around at the moment.

Would it be an option for you to just remove all JARs from /Library/Java/Extensions/? Or is there another application that requires them?

Screenshot:

hey! deleting my JARs worked!!! thank you! but i have another problem now… pls help…

what should I do for this?

Happy to hear that the solution worked for you.

The other issue looks to me as if there is a missing Android dependencies. These have to be installed locally first with the Android SDK manager (due to Google licensing). Usually, clicking on Install Repository and sync project should help you to resolve the problem. The Android Support Repository is what you want to install.