将 HAPI-FHIR 依赖项添加到 gradle Android 项目中

Adding HAPI-FHIR dependencies into gradle Android project

我正在尝试将以下依赖项添加到我的 android 工作室项目中,但似乎出现了我不明白的错误!

compile 'ca.uhn.hapi.fhir:hapi-fhir-base:1.4'
compile 'ca.uhn.hapi.fhir:hapi-fhir-structures-hl7org-dstu2:1.4'
compile 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu2:1.4'
compile 'org.slf4j:slf4j-simple:1.6.1'

这是错误:

    Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for lintOptions as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preLintOptionsBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportPercent2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComJjoe64Graphview401Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: /PolimiMac/PersonalHealthRecord/app/src/main/java/polimi/aap/yas/personalhealthrecord/Chronograms.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithJarMergingForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/json/Json.class
Information:BUILD FAILED
Information:Total time: 27.738 secs
Information:1 error
Information:3 warnings
Information:See complete output in console

事实上,在添加这些依赖项之前,一切正常,没有错误。 你知道问题出在哪里吗?! 预先感谢您的帮助!

终于可以解决问题了。清洁和重建项目不是解决方案! 我在Gradle中没有通过写代码来添加依赖。 事实上,我从以下 link 下载了 Jar 库: http://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-android/1.5

我下载了三个我需要的库:

hapi-fhir-structures-dstu2-1.5.jar , hapi-fhir-base-1.5.jar , hapi-fhir-android-1.5.jar

然后我将它们移动到应用程序的 "lib" 文件夹 -> 同步 gradle