安装后的错误:Jackson 2将Java对象转换为JSON或从JSON转换

时间:2016-09-13 10:08:57

标签: android-studio

I am following Jackson 2 to Convert Java Object to / from JSON

我在gradle中添加了以下内容。

compile (
    [group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
    [group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
    [group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)

,我的gradle文件如下所示

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.pankajgarg.database"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
                       , 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile (
      [group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
      [group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
      [group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
    )
}

packagingOptions {
    exclude 'META-INF/LICENSE.txt'
}

编译后我遇到错误。

enter image description here

你以前遇到过这类问题吗?

1 个答案:

答案 0 :(得分:0)

我最后更正的格斗低于

apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.pankajgarg.database"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    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'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile (
      [group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
      [group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
      [group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
    )
}