Search code examples
android-studiogradlenoclassdeffounderrorartifact

Android Studio include maven artifact in APK (gradle)


I have an Android project that requires the Jsoup library. I've tried everything I can think of to get the jar shaded into the APK.. I just can't get it working. Logcat tells me:

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: org.jsoup.Jsoup

Does anyone know how to include/shade a maven artifact into an APK with Android Studio?


Solution

  • I have found the answer. The trick is to append ":sources". See an example here: http://www.alonsoruibal.com/my-gradle-tips-and-tricks/