对于我的Android项目,我将Gradle与Jackson 2.2.x设置如下:
// 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.+'
}
Run Code Online (Sandbox Code Playgroud)
我只是使用ObjectMapper这里:
import com.fasterxml.jackson.databind.ObjectMapper;
// ...
ObjectMapper objectMapper = new ObjectMapper();
try {
Content content = objectMapper.readValue(inputStream, Content.class);
} catch (IOException e) {
e.printStackTrace();
} …Run Code Online (Sandbox Code Playgroud) 我想在我的项目中使用bottomBar库.当我gradle在build.gradle文件中添加正确的命令时sync,我收到此错误:
Failed to resolve: com.roughike:bottom-bar:2.0
Run Code Online (Sandbox Code Playgroud)
我搜索了很多原因.一个解决方案是使用jcenter(),但在我的国家/地区无法访问,并且同步最长可达1或在某些情况下为2小时.所以我改用maven.在这种情况下,如何使用库主页上推荐的maven命令?我应该在哪里放下以下代码?
<dependency>
<groupId>com.roughike</groupId>
<artifactId>bottom-bar</artifactId>
<version>2.+</version>
<type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)