How to resolve java.lang.NoClassDefFoundError in android?

I included import.io jar in my Android project, tried to run the 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 made google and decided that something was wrong with the Jackson library, I added it, but nothing has changed. There are many different solutions for this error, but I cannot resolve it in my case. Could you give me some advice please?

I am using Android Studio with Android SDK Tools v22.3. I also tried to run this project in eclipse (obviously with jar) 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 as a file dependency, I think this is the right option. In addition, there are no compilation errors until I use these methods. And, of course, these banks are in the folder lib.

+3
3

, . jackson-all-1.9.11.jar

Jackson (core, mapper ..)

0

jar jackson-core-asl-1.9.12.jar . , , classpath.

+2

Please check if you are using version ADT 17. If yes, see if the link below helps:

http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

0
source

All Articles