hapifhir / hapi-fhir-android-integration-test

Hapi FHIR android Integration Test
Apache License 2.0
7 stars 7 forks source link

Not working with okhttp3 #7

Open pravingaikwad07 opened 3 years ago

pravingaikwad07 commented 3 years ago

using okhttp3 version :

 implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.1"))
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

and fhir version:

  implementation ('ca.uhn.hapi.fhir:hapi-fhir-android:5.4.0')
    implementation "ca.uhn.hapi.fhir:hapi-fhir-structures-r4:5.4.0"

but getting error on: client!!.search().forResource(Patient::class.java) .where(ReferenceClientParam("organization").hasId(managingOrgRefId)) .prettyPrint() .returnBundle(Bundle::class.java) .execute()

error: Process: com.ehr.myairmed, PID: 18952 java.lang.NoClassDefFoundError: Failed resolution of: **Lokhttp3/internal/Version;** at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addUserAgentHeader(OkHttpRestfulClient.java:130) at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addHeadersToRequest(OkHttpRestfulClient.java:123) at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.initBaseRequest(OkHttpRestfulClient.java:76) at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.createGetRequest(OkHttpRestfulClient.java:112) at ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation.createHttpRequest(BaseHttpClientInvocation.java:77) at ca.uhn.fhir.rest.client.method.HttpGetClientInvocation.asHttpRequest(HttpGetClientInvocation.java:106) at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:266) at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540) at ca.uhn.fhir.rest.client.impl.GenericClient$FetchConformanceInternal.execute(GenericClient.java:832) at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBase(RestfulClientFactory.java:300) at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBaseIfConfiguredToDoSo(RestfulClientFactory.java:264) at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:227) at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540) at ca.uhn.fhir.rest.client.impl.GenericClient$SearchInternal.execute(GenericClient.java:1994) at com.ehr.myairmed.hl7.Hl7FhirHelper$getPatientList$1.invokeSuspend(Hl7FhirHelper.kt:71) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Version" on path: DexPathList[[zip file "/data/app/com.ehr.myairmed-PmBruunO0gzf42vs1DzCoA==/base.apk"],nativeLibraryDirectories=[/data/app/com.ehr.myairmed-PmBruunO0gzf42vs1DzCoA==/lib/arm64, /data/app/com.ehr.myairmed-PmBruunO0gzf42vs1DzCoA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addUserAgentHeader(OkHttpRestfulClient.java:130)  at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addHeadersToRequest(OkHttpRestfulClient.java:123)  at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.initBaseRequest(OkHttpRestfulClient.java:76)  at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.createGetRequest(OkHttpRestfulClient.java:112)  at ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation.createHttpRequest(BaseHttpClientInvocation.java:77)  at ca.uhn.fhir.rest.client.method.HttpGetClientInvocation.asHttpRequest(HttpGetClientInvocation.java:106)  at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:266)  at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540)  at ca.uhn.fhir.rest.client.impl.GenericClient$FetchConformanceInternal.execute(GenericClient.java:832)  at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBase(RestfulClientFactory.java:300)  at ca.uhn.fhir.rest.client.impl.RestfulClientFactory.validateServerBaseIfConfiguredToDoSo(RestfulClientFactory.java:264)  at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:227)  at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:540)  at ca.uhn.fhir.rest.client.impl.GenericClient$SearchInternal.execute(GenericClient.java:1994)  at com.ehr.myairmed.hl7.Hl7FhirHelper$getPatientList$1.invokeSuspend(Hl7FhirHelper.kt:71)  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)  I/Process: Sending signal. PID: 18952 SIG: 9 Ques 1: How to resolve this ??

Ques 2: How to parse getPatientsList response using Retrofit. I am using Call getPatients, I am getting correct response Retrofit isn't mapping the response.