12

I have a gradle project that builds perfectly. The jar runs perfectly. When I try to import it into IntelliJ via gradle, I get the following error:

Unable to load class 'org.slf4j.LoggerFactory'.

I don't even use that within my project.

Any ideas?

Here is a gist with the log: https://gist.github.com/anonymous/991f8daab0ff3047db9a11d015492fe5

Also, an screen shot for reference: https://i.stack.imgur.com/sV95D.jpg

1
  • I'm having this problem now and tried reinstalling as suggested by the only answer here. Did you ever solve this?
    – Ryan E
    Oct 1, 2016 at 15:41

2 Answers 2

27

I had a similar problem: while trying to open a Gradle project, IntelliJ throws an error: Unable to load class 'org.slf4j.LoggerFactory'.

Instead of the local gradle distribution, choose the "use gradle wrapper" task configuration option. You can change this in Settings | Build, Execution, Deployment | Gradle | Project-level settings

2

IntelliJ uses it internally alongside many other libraries - you may want to check the JAR to see if it's still valid. It lives in <INTELLIJ_DIR>/lib. If not, you can replace it manually (IntellIJ 2016.2 packages log4j 1.2). If you encounter further issues, you may have other corrupted libraries (at least that was the case when this happened to me). As far as I'm aware there's no simple way to repopulate the lib folder, so the cleanest solution may just be a reinstall of the IDE if it proves to be tedious to manually fix.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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