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

时间:2016-06-12 16:00:09

标签: java android gradle hapi-fhir

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

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

实际上,在添加这些依赖项之前,一切正常,没有错误。 你知道这是什么问题吗?! 提前感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

最后我可以解决问题。清洁和重建项目不是解决方案! 我没有通过在Gradle中编写代码来添加依赖项。 事实上我从以下链接下载了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-机器人-1.5.jar

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