Billyjoker
Billyjoker

Reputation: 751

Importing Gradle in Android Project but some jar dependencies not founded

I'm noob with Gradle, and i'm trying to integrate an existing project to my android project. This is what i've performed:

  1. Gradle project is working like a charm when is executed standalone
  2. I've executed gradlew clean distZip and gradlew distZip to create a working jar to be included in my android project
  3. I've added the jar as external and checke the file at order and export window
  4. I've executed my android project and i can debug inside executions from gradle
  5. It is thrown a java.lang.NoClassDefFoundError: javax.json.JsonObject exception

I do not know what's wrong with this. I attach some logs and pictures:

10-07 10:02:51.166: W/dalvikvm(1950): VFY: unable to find class referenced in signature (Ljavax/script/ScriptEngine;)
10-07 10:02:51.168: W/dalvikvm(1950): VFY: unable to resolve interface method 23354: Ljavax/script/ScriptEngine;.getBindings (I)Ljavax/script/Bindings;
10-07 10:02:51.170: W/dalvikvm(1950): Unable to resolve superclass of Lsimple/escp/fill/DataSourceBinding; (2807)
10-07 10:02:51.170: W/dalvikvm(1950): Link of class 'Lsimple/escp/fill/DataSourceBinding;' failed
10-07 10:02:51.177: E/dalvikvm(1950): Could not find class 'javax.json.JsonObject', referenced from method simple.escp.data.DataSources.
10-07 10:02:51.177: W/dalvikvm(1950): VFY: unable to resolve const-class 2753 (Ljavax/json/JsonObject;) in Lsimple/escp/data/DataSources;
10-07 10:02:51.178: W/dalvikvm(1950): Exception Ljava/lang/NoClassDefFoundError; thrown while            iniitializing Lsimple/escp/data/DataSources;
10-07 10:02:51.179: W/dalvikvm(1950): threadid=1: thread exiting with uncaught exception (group=0x410ba9a8)
10-07 10:02:51.182: E/AndroidRuntime(1950): FATAL EXCEPTION: main
10-07 10:02:51.182: E/AndroidRuntime(1950): java.lang.NoClassDefFoundError: javax.json.JsonObject
10-07 10:02:51.182: E/AndroidRuntime(1950): at simple.escp.data.DataSources.(DataSources.java:26)
10-07 10:02:51.182: E/AndroidRuntime(1950): at com.prv.pdf2jpg.MainActivity$2.onClick(MainActivity.java:181)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.view.View.performClick(View.java:4211)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.view.View$PerformClick.run(View.java:17456)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.os.Handler.handleCallback(Handler.java:725)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.os.Handler.dispatchMessage(Handler.java:92)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.os.Looper.loop(Looper.java:153)
10-07 10:02:51.182: E/AndroidRuntime(1950): at android.app.ActivityThread.main(ActivityThread.java:5293)
10-07 10:02:51.182: E/AndroidRuntime(1950): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 10:02:51.182: E/AndroidRuntime(1950): at java.lang.reflect.Method.invoke(Method.java:511)
10-07 10:02:51.182: E/AndroidRuntime(1950): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
10-07 10:02:51.182: E/AndroidRuntime(1950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
10-07 10:02:51.182: E/AndroidRuntime(1950): at dalvik.system.NativeStart.main(Native Method)

Picture: http://oi58.tinypic.com/21nfl7m.jpg build tree eclipse explorer

Upvotes: 0

Views: 350

Answers (1)

djardon
djardon

Reputation: 161

You have to add the lib folder in build.gradle:

dependencies 
{
    compile files('libs/mylib.jar')
}

or

dependencies 
{
    compile fileTree(dir: 'libs', include: '*.jar')
}

Upvotes: 1

Related Questions