Adding an external jar library to Intellij IDEA

steve picture steve · May 17, 2011 · Viewed 23k times · Source

I'm having a silly problem : I'm trying to add the Jsoup library (which is just an external jar) to my android application developed in Intellij Idea and it seems and don't do it right . I put the library in the libs folder , then I went in Project Structure -> modules and selected dependencies , select add global library , select attach source and click ok.

When I write code it is able to automatically import classes and to compile , but when running I get " java.lang.NoClassDefFoundError: org.jsoup.Jsoup"

Answer

Alfie Hanssen picture Alfie Hanssen · Jun 3, 2013
  • Copy the .jar file into your lib/ directory.
  • Right click the new .jar in the lefthand file browser in IntelliJ / Android Studio
  • Choose "Add as Library..."
  • Voila!