繁体   English   中英

Android studio hapi fhir validation, checkDebugDuplicateClasses 错误

[英]Android studio hapi fhir validation, checkDebugDuplicateClasses error

我正在尝试构建一个简单的 android 项目,我想在其中使用一些 hapi-fhir 依赖项。 但是,尽管构建成功,但当我运行应用程序时,出现重复类错误。 我要添加的依赖项如下:

implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:4.1.0'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-validation', version: '4.1.0'

在注释掉每一个之后,我得出结论,这个问题源于最后一个(hapi-fhir-validation)。

我还添加了此依赖项以防止以前的一些问题。

实现'androidx.multidex:multidex:2.0.1'

运行失败的任务如下:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class org.apache.commons.logging.Log found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     Duplicate class org.apache.commons.logging.LogConfigurationException found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     Duplicate class org.apache.commons.logging.LogFactory found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     Duplicate class org.apache.commons.logging.impl.SimpleLog$1 found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'META-INF/DEPENDENCIES'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 8s

关于如何进行的任何建议都将非常有用。 如果您需要更多信息,请告诉我。

先感谢您!!

目前通过导入依赖项同时排除显示为重复项的依赖项来完成这项工作,如下所示:

implementation('ca.uhn.hapi.fhir:hapi-fhir-validation:4.1.0'){
    exclude group: 'commons-logging', module: 'commons-logging'
}

代替:

 implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation:4.1.0'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM