Hello,
I am attempting to build an Android-based client for a FHIR server, and am trying to use the HAPI FHIR client with HL7 DSTU2 data model, but am having many problems...
- When I attempt to define the dependencies thusly (as is described in the docs, but with the version switched to the stable release):
compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-android', version: '1.4', classifier: 'dstu2'
I get this problem on build:
Error:(13, 35) error: package org.hl7.fhir.instance.model does not exist
So it appears that the HL7 DSTU2 data model is missing from the jar.
- However, if I define the dependencies thusly (like the regular client dependencies, but removing the problematical stax and woodstock libs, which clash with Android system classes):
compile ('ca.uhn.hapi.fhir:hapi-fhir-base:1.4') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'woodstox'
exclude module: 'woodstox-core-asl'
}
compile ('ca.uhn.hapi.fhir:hapi-fhir-structures-hl7org-dstu2:1.4') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'woodstox'
exclude module: 'woodstox-core-asl'
}
compile ('ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu2:1.4') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'woodstox'
exclude module: 'woodstox-core-asl'
}
However, even though the app builds and deploys OK, I get this problem at runtime:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/conn/PoolingHttpClientConnectionManager;
at ca.uhn.fhir.rest.client.RestfulClientFactory.getHttpClient(RestfulClientFactory.java:104)
at ca.uhn.fhir.rest.client.RestfulClientFactory.newGenericClient(RestfulClientFactory.java:208)
at ca.uhn.fhir.context.FhirContext.newRestfulGenericClient(FhirContext.java:378)
...
This same code, with the same gradle dependencies config (except I didn't exclude the stax and woodstox modules) worked fine in a plain java application.
Has anyone had any recent success with using the HAPI FHIR client on Android, and if so, any idea how I can solve these issues?
Thanks,
Douglas Harley