Search code examples
androidjargradlelibgdxnoclassdeffounderror

LibGDX - Intellij - Add Jar


I have followed documentation on how to add an external jar to the libgdx project, added jar to a new folder called "libs" inside core project, then:

build.gradle:

project(":core") {
  apply plugin: "java"


  dependencies {
    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    compile fileTree(dir: 'libs', include: '*.jar')
  }
}

notice compile fileTree(dir: 'libs', include: '*.jar') inside dependecies. Then open Gradle view panel and refresh. After all this when i try to debug on an Android device, it throws NoClassDefFoundError exception.

What am i doing wrong? i can debug for desktop.

Im adding jlayer from JavaZoom.


Solution

  • Ok, so i added "compile fileTree(dir: 'libs', include: '*.jar')" to the Android project inside build.gradle and copy the jar to libs inside Android project directory, now does not throw that error, apparently was some problem with gradle and android. Problem now is that it throws VerifyError, will make a new question with that. –