android - 错误:程序类型已经存在:com.fasterxml.jackson.core.Base64Variant
问题描述
当我编译我的代码时,我得到了这个异常:
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
解决方案
我找到了解决该问题的方法;我只是在我的 libs 文件夹中添加库 jackson-core。我删除了它,所以,现在它可以工作了。
推荐阅读
- r - 如何嵌套 ifelse 语句以适应三个条件
- excel - 复制命名范围并将其粘贴到另一个工作表中而不覆盖数据
- python - Python:Foursquare API 和请求需要 cookie 和 javascript
- python - 负对数似然的约简参数
- javascript - 如何使用 Google File Picker API 下载文件?
- rendering - RealityKit 如何在运行时创建自定义网格?
- javascript - JavaScript - 比较非常大的对象数组的有效方法
- sqlite - SQLite 可以返回不存在的列的默认值而不是错误吗?
- ansible - 在 Ansible 中的角色内运行具有特定标签的任务
- linux - Tensorflow 在 proto-files 上创建错误