Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve java.lang.NoClassDefFoundError in android?

I included import.io jar into my android project, tried to run example and got the following:

FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.importio.api.clientlite.json.JacksonJsonImplementation$1
            at com.importio.api.clientlite.json.JacksonJsonImplementation.<init>(JacksonJsonImplementation.java:17)
            at com.importio.api.clientlite.ImportIO.connect(ImportIO.java:235)
            at com.gomel.data.ImportIOTest.showandgetData(ImportIOTest.java:33)
            at com.gomel.activities.DetailedArticleActivity$1.onClick(DetailedArticleActivity.java:40)
            at android.view.View.performClick(View.java:4247)
            at android.view.View$PerformClick.run(View.java:17733)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5289)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)

I did google and decided that something wrong with jackson library, I had added it, but nothing changed. There is a lot of different solutions about this error here, but I cant resolve it in my case. Could you give me some advice, please?

I use Android Studio with Android SDK Tools v22.3 Also I have tried to run this project in eclipse (with jar obviously) and got the same error.

UPD

My build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 18
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 18
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    } }

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile files('lib/com.importio.api.clientlite-1.0.2.jar')
    compile files('lib/jackson-core-asl-1.9.12.jar') }

enter image description here

I added it like a file dependencies, think it is the right option. Also there is no compile error while I don't use this methods. And of course this jars are in the lib folder.

like image 674
pavelartlover Avatar asked Dec 30 '25 19:12

pavelartlover


1 Answers

Required jar jackson-core-asl-1.9.12.jar is missing So you have to download the jar and then set your classpath.

like image 87
Ashish Avatar answered Jan 01 '26 10:01

Ashish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!