有关我的Android项目我成立了摇篮与杰克逊的2.2.x 如下:
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.+'
}
我简单地使用 ObjectMapper
这里:
import com.fasterxml.jackson.databind.ObjectMapper;
// ...
ObjectMapper objectMapper = new ObjectMapper();
try {
Content content = objectMapper.readValue(inputStream, Content.class);
} catch (IOException e) {
e.printStackTrace();
}
当我运行摇篮installDebug
并启动它的应用程序崩溃的相关部分:
When I run gradle installDebug
and launch the relevant part of the application it crashes:
java.lang.NoClassDefFoundError的:com.fasterxml.jackson.databind.ObjectMapper
java.lang.NoClassDefFoundError: com.fasterxml.jackson.databind.ObjectMapper
我注意到,在错误信息 com.fasterxml.jackson ...
被提及,而 com.fasterxml.jackson.core
在 build.gradle 。是否有不匹配导致的吗?
我暂时搬到了
依赖
块到机器人
块,因为我的