当我编译代码时,出现此异常:
com.android.tools.r8.utils.AbortException:错误:程序类型已存在:com.fasterxml.jackson.core.Base64Variant
我知道我应该排除一些传递性依赖,但我不知道该怎么做
这些是我的依赖项
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
在我添加以下行之前,代码运行良好:
ObjectMapper mapper=new ObjectMapper();
JsonNode responseNode= null;
try {
responseNode = mapper.readTree(response);
} catch (IOException e) {
e.printStackTrace();
}
assert responseNode != null;
int SUCCESS = responseNode.get("success").asInt();
Toast.makeText(getApplication(), SUCCESS, Toast.LENGTH_SHORT).show();
我得到4个错误:
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException: Error: Program type already present: com.fasterxml.jackson.core.Base64Variant
答案 0 :(得分:0)