android jackson gradle,NoClassDefFoundError using Jackson 2.2.x on Android with Gradle

For my Android project I set up Gradle with Jackson 2.2.x as follows:

// build.gradle

buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath 'com.android.tools.build:gradle:0.6.+'

}

}

apply plugin: 'android'

repositories {

mavenCentral()

}

android {

compileSdkVersion 18

buildToolsVersion "18.1.0"

defaultConfig {

minSdkVersion 8

targetSdkVersion 18

}

}

dependencies {

compile 'com.android.support:appcompat-v7:18.0.0'

compile 'com.android.support:support-v4:18.0.0'

compile 'com.google.android.gms:play-services:3.1.36'

compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'

compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'

compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'

}

I simply use the ObjectMapper here:

import com.fasterxml.jackson.databind.ObjectMapper;

// ...

ObjectMapper objectMapper = new ObjectMapper();

try {

Content content = objectMapper.readValue(inputStream, Content.class);

} catch (IOException e) {

e.printStackTrace();

}

When I run gradle installDebug and launch the relevant part of the application it crashes:

java.lang.NoClassDefFoundError: com.fasterxml.jackson.databind.ObjectMapper

Thoughts:

I noticed that in the error message com.fasterxml.jackson... is mentioned while com.fasterxml.jackson.core is defined in build.gradle. Is there a mismatch causing the problem?

I temporarily moved the dependencies block into the android block since I found other build.gradle configurations structured this way. However it seems to make no difference.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值