NoClassDefFoundError using Jackson 2.2.x on Android with Gradle

萝らか妹 提交于 2019-11-29 10:02:24

Gradle and Android don't always place nicely with dependencies(yet). Running

 gradle clean

seems to fix most problems for me.

Note: If that didn't work, you can run

dexdump classes.dex | grep 'Class descriptor'

on the classes.dex file in the APK. That will check to see if the class is included in the classes.dex file. (Sometimes it's useful if you want to double check whats going on).

Raj Kumar

Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.app.test"
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 4
        versionName "1.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')  
    compile 'com.android.support:appcompat-v7:22.2.0'  `enter code here`
    compile 'com.fasterxml.jackson.core:jackson-databind :2.5.3'

}

Add permission and dependency into you Gradle and then build gradle you will get Object wrapper class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!