Android development

722 views
Skip to first unread message

Al Amyot

unread,
Dec 1, 2014, 1:34:39 PM12/1/14
to hapi...@googlegroups.com
I am a novice at java development but am attempting to experiment with HAPI FHIR on Android. I am using Android Studio for development.

I added a dependency to my project (in Gradle? format)

compile 'ca.uhn.hapi.fhir:hapi-fhir-base:0.7'

I get the following warnings at compile time:

Warning:Dependency org.apache.httpcomponents:httpclient:4.3.3 is ignored for debug as it may be conflicting with the internal version provided by Android.

and

:app:preDexDebug
trouble processing "javax/xml/stream/EventFilter.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

Is the HAPI library compatible with Android development?

david hay

unread,
Dec 2, 2014, 12:47:55 PM12/2/14
to hapi...@googlegroups.com
Did it actually compile (despite the warnings)? And, if so, did it seem to function normally? ie were you able to contact a server (I assume you are using it as a client)...

cheers...

Al Amyot

unread,
Dec 2, 2014, 1:53:36 PM12/2/14
to david hay, hapi...@googlegroups.com
If I do a Make it ends with Build Successful however if I Run the project it says Build Failed. Here is the complete output from the Run:


--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/f587b862-9771-4921-9117-b1d6e43295cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Al Amyot

unread,
Dec 2, 2014, 1:55:41 PM12/2/14
to david hay, hapi...@googlegroups.com
something happened when I pasted in the log . It is attached instead
build_log.txt

Al Amyot

unread,
Dec 2, 2014, 2:34:26 PM12/2/14
to david hay, hapi...@googlegroups.com
This article seems to describe the problem. https://github.com/CUTR-at-USF/SiriRestClient/wiki/Modifying-XML-libraries-for-Android

I do not want to use XML but your reference client seems to depend on some of these libraries

On Tue, Dec 2, 2014 at 11:47 AM, david hay <david...@gmail.com> wrote:

--

James Agnew

unread,
Dec 2, 2014, 10:30:29 PM12/2/14
to Al Amyot, david hay, hapi...@googlegroups.com
Hi Al,

This is interesting, to say the least. :)

I think you're the first one to try and use HAPI-FHIR in Android, but I think in theory at least it should be possible.

I see two errors in your provided log- The first is that Apache commons-httpclient is being ignored, which makes sense since the Android SDK bundles that library. The second is that the StAX API is failing because it's not supported in Android.

StAX is an XML parsing library that HAPI depends on, and unfortunately currently it is required even for JSON parsing because it is used to parse the narrative text (which is XHTML embedded in a JSON value). That parsing is really only neccesary though for validation and presumably you don't need validation on a mobile app anyway so we should be able to work around it.

Do you have the bandwidth/desire to try a few things in order to see if we can get this working together?

Cheers,
James

Al Amyot

unread,
Dec 3, 2014, 9:47:51 AM12/3/14
to James Agnew, david hay, hapi...@googlegroups.com
It seems this is a known problem with XML on Android


I could try the solution given above but I'm not a Java developer and will have to hope that the instructions are dead simple.

Do you have other suggestions to try? I do have some time available.

Al Amyot

unread,
Dec 4, 2014, 3:49:07 PM12/4/14
to david hay, hapi...@googlegroups.com
Sorry for not responding sooner David. I've been working with James Agnew of UHN who is trying to repackage the libraries . I've tried both HAPI FIHR and the DSTU reference implementation and both seem to conflict with the Java implementations on Android which terms out to be quite different. I've emailed Llyod McKenzie just now to see if he has any ideas. I can't believe that I'm the first to try this!

On Tue, Dec 2, 2014 at 11:47 AM, david hay <david...@gmail.com> wrote:

--

Al Amyot

unread,
Dec 17, 2014, 10:01:08 AM12/17/14
to hapi...@googlegroups.com
has anyone managed yet to get a FHIR Java client working on Android?


On Thursday, December 4, 2014 2:49:07 PM UTC-6, Al Amyot wrote:
Sorry for not responding sooner David. I've been working with James Agnew of UHN who is trying to repackage the libraries . I've tried both HAPI FIHR and the DSTU reference implementation and both seem to conflict with the Java implementations on Android which terms out to be quite different. I've emailed Llyod McKenzie just now to see if he has any ideas. I can't believe that I'm the first to try this!
On Tue, Dec 2, 2014 at 11:47 AM, david hay <david...@gmail.com> wrote:
Did it actually compile (despite the warnings)? And, if so, did it seem to function normally? ie were you able to contact a server (I assume you are using it as a client)...

cheers...

On Tuesday, December 2, 2014 7:34:39 AM UTC+13, Al Amyot wrote:
I am a novice at java development but am attempting to experiment with HAPI FHIR on Android. I am using Android Studio for development.

I added a dependency to my project (in Gradle? format)

compile 'ca.uhn.hapi.fhir:hapi-fhir-base:0.7'

I get the following warnings at compile time:

Warning:Dependency org.apache.httpcomponents:httpclient:4.3.3 is ignored for debug as it may be conflicting with the internal version provided by Android.

and

:app:preDexDebug
trouble processing "javax/xml/stream/EventFilter.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

Is the HAPI library compatible with Android development?

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.

Tom Wilson

unread,
Jan 8, 2015, 7:40:47 PM1/8/15
to hapi...@googlegroups.com
This seems to work with v0.8 but I haven't tried anything meaningful with it. So far I only compiled the libraries and some basic client code in an Android app and run it (both on an emulator and physical device), but it's not connecting to a FHIR server yet. I hope to have a more complete app doing FHIR queries sometime next week. 

Here is my dependency declaration in build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'ca.uhn.hapi.fhir:hapi-fhir-base:0.8'
    compile 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu:0.8'
}


On Wednesday, December 17, 2014 at 7:01:08 AM UTC-8, Al Amyot wrote:
has anyone managed yet to get a FHIR Java client working on Android?

On Thursday, December 4, 2014 2:49:07 PM UTC-6, Al Amyot wrote:
Sorry for not responding sooner David. I've been working with James Agnew of UHN who is trying to repackage the libraries . I've tried both HAPI FIHR and the DSTU reference implementation and both seem to conflict with the Java implementations on Android which terms out to be quite different. I've emailed Llyod McKenzie just now to see if he has any ideas. I can't believe that I'm the first to try this!
On Tue, Dec 2, 2014 at 11:47 AM, david hay <david...@gmail.com> wrote:
Did it actually compile (despite the warnings)? And, if so, did it seem to function normally? ie were you able to contact a server (I assume you are using it as a client)...

cheers...

On Tuesday, December 2, 2014 7:34:39 AM UTC+13, Al Amyot wrote:
I am a novice at java development but am attempting to experiment with HAPI FHIR on Android. I am using Android Studio for development.

I added a dependency to my project (in Gradle? format)

compile 'ca.uhn.hapi.fhir:hapi-fhir-base:0.7'

I get the following warnings at compile time:

Warning:Dependency org.apache.httpcomponents:httpclient:4.3.3 is ignored for debug as it may be conflicting with the internal version provided by Android.

and

:app:preDexDebug
trouble processing "javax/xml/stream/EventFilter.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

Is the HAPI library compatible with Android development?

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.

James Agnew

unread,
Jan 8, 2015, 10:12:17 PM1/8/15
to Tom Wilson, hapi...@googlegroups.com
Hi Tom, (and everyone)

I mentioned this to Al already, but I did some experimentation with Maven's shade plugin and produced a single HAPI JAR with all of its dependencies bundled and the XML libraries (which live in the forbidden javax.xml package) relocated so that they would work in Android. If you happen to be interested in trying it let me know and I'll send you a download link.

I'd love to get some real world testing of it (I am personally interested in Android but I'm not particularly knowledgeable about it) so that it could be properly released..

Cheers,
James

Al Amyot

unread,
Jan 8, 2015, 10:20:18 PM1/8/15
to James Agnew, Tom Wilson, hapi...@googlegroups.com
Hi James! I don't have the free time that I did back in December and so have not been able to test your changes - but I have not forgotten! I will attempt to try this out soon

Tom Wilson

unread,
Jan 9, 2015, 12:08:11 PM1/9/15
to hapi...@googlegroups.com, twils...@gmail.com
I would love to try that, if you can send me the download link. Thanks!

-tom

Tom Wilson

unread,
Jan 9, 2015, 12:15:55 PM1/9/15
to hapi...@googlegroups.com, twils...@gmail.com
Also, can the same thing be done with Gradle?

-tom

James Agnew

unread,
Jan 9, 2015, 1:26:04 PM1/9/15
to Tom Wilson, hapi...@googlegroups.com
Done. If you (or anyone) would like to try out the current Android build, please download the combined JAR here:
https://fileportal.uhn.ca/download.aspx?ID=519ef21f-48a6-4410-9320-014f7443eeb9

Note that you can currently build you own copy of this if you have the hapi-fhir source checked out by:
1. Build HAPI completely
mvn install
2. Enter the hapi-fhir-base directory
cd hapi-fhir-base
3. Build hapi-fhir-base using a profile
mvn -P ANDROID clean install
4. The "hapi-fhir-base-0.9-SNAPSHOT.jar" that is built should now contain relocated dependencies and be suitable for Android.

Cheers,
James

James Agnew

unread,
Jan 9, 2015, 1:27:34 PM1/9/15
to Tom Wilson, hapi...@googlegroups.com
Unfortunately for now you'll need to manually add it to your local repository to use it with Gradle. Once we have confirmed that it works though, I'll definitely add it to the main build process so that it's available in the public repos for Maven/Gradle/etc.

Cheers,
James

Tom Wilson

unread,
Jan 9, 2015, 3:01:02 PM1/9/15
to hapi...@googlegroups.com, twils...@gmail.com
Thanks. The build works and we will be trying it out and posting feedback. I think Android support is going to be very important and will help any way I can.

-tom

hshriv...@gmail.com

unread,
Jan 9, 2015, 3:49:01 PM1/9/15
to hapi...@googlegroups.com, twils...@gmail.com
I downloaded the 'hapi-fhir-base-0.9-SNAPSHOT.jar' file and built a sample app with it in AndroidStudio, the app successfully compiled but crashed when I tried to create a newRestfulGenericClient by doing the following code for getting patient information

FhirContext  ctx = new FhirContext();
client = ctx.newRestfulGenericClient(SERVER_BASE);


java.lang.NoClassDefFoundError: org.apache.http.impl.conn.PoolingHttpClientConnectionManager
            at ca.uhn.fhir.rest.client.RestfulClientFactory.getHttpClient(RestfulClientFactory.java:98)
            at ca.uhn.fhir.rest.client.RestfulClientFactory.newGenericClient(RestfulClientFactory.java:166)
            at ca.uhn.fhir.context.FhirContext.newRestfulGenericClient(FhirContext.java:320)
            at xxxx.DHPClient.<init>(DHPClient.java:25)
            at xxxx.DisplayPatientActivity.onCreate(DisplayPatientActivity.java:19)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
            at android.app.ActivityThread.access$600(ActivityThread.java:130)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)

I tried adding httpclient-4.3.6.jar in the libs folder but that didn’t work, is there anything that I missed? 

Thanks

Himanshu

James Agnew

unread,
Jan 9, 2015, 4:11:00 PM1/9/15
to hshriv...@gmail.com, hapi...@googlegroups.com, Tom Wilson
Hmm interesting. HTTPClient is actually not included in the Android JAR and I guess it should be.

Adding it manually should work though. I know httpclient.jar depends on httpcore.jar, maybe it would need that one added too.

Either way, here's a new version with that dependency added:
https://fileportal.uhn.ca/download.aspx?ID=6d9e4539-cd14-47e5-ad41-3c454b09ed4c

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

Himanshu Shrivastava

unread,
Jan 9, 2015, 4:33:15 PM1/9/15
to James Agnew, hapi...@googlegroups.com, Tom Wilson
After using the new jar file I get this


Could not find method org.apache.commons.codec.binary.Base64.encodeBase64String, referenced from method ca.uhn.fhir.model.primitive.Base64BinaryDt.encode
W/dalvikvm( 7788): VFY: unable to resolve static method 29914: Lorg/apache/commons/codec/binary/Base64;.encodeBase64String ([B)Ljava/lang/String;
D/dalvikvm( 7788): VFY: replacing opcode 0x71 at 0x0000
I/dalvikvm( 7788): Could not find method org.apache.commons.codec.binary.Base64.decodeBase64, referenced from method ca.uhn.fhir.model.primitive.Base64BinaryDt.parse
W/dalvikvm( 7788): VFY: unable to resolve static method 29909: Lorg/apache/commons/codec/binary/Base64;.decodeBase64 (Ljava/lang/String;)[B
D/dalvikvm( 7788): VFY: replacing opcode 0x71 at 0x0000
W/audio_hw_primary(  127): out_write() limiting sleep time 50792 to 39909
D/dalvikvm( 7788): GC_CONCURRENT freed 525K, 5% free 11757K/12359K, paused 0ms+1ms, total 3ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 2ms
D/dalvikvm( 7788): GC_CONCURRENT freed 496K, 5% free 11772K/12359K, paused 0ms+1ms, total 3ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 1ms
D/dalvikvm( 7788): GC_CONCURRENT freed 547K, 6% free 11799K/12423K, paused 1ms+0ms, total 5ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 2ms
I/dalvikvm( 7788): Could not find method com.phloc.commons.url.URLValidator.isValid, referenced from method ca.uhn.fhir.context.RuntimeResourceDefinition.getResourceProfile
W/dalvikvm( 7788): VFY: unable to resolve static method 28147: Lcom/phloc/commons/url/URLValidator;.isValid (Ljava/lang/String;)Z
D/dalvikvm( 7788): VFY: replacing opcode 0x71 at 0x000a
D/dalvikvm( 7788): GC_CONCURRENT freed 490K, 5% free 11820K/12423K, paused 1ms+0ms, total 4ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 2ms
D/dalvikvm( 7788): GC_CONCURRENT freed 490K, 5% free 11842K/12423K, paused 0ms+1ms, total 4ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 1ms
D/dalvikvm( 7788): GC_CONCURRENT freed 543K, 5% free 11866K/12487K, paused 0ms+1ms, total 4ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 1ms
D/dalvikvm( 7788): GC_CONCURRENT freed 486K, 5% free 11892K/12487K, paused 0ms+0ms, total 4ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 2ms
D/dalvikvm( 7788): GC_CONCURRENT freed 490K, 5% free 11914K/12487K, paused 0ms+2ms, total 4ms
D/dalvikvm( 7788): WAIT_FOR_CONCURRENT_GC blocked 2ms
I/ModelScanner( 7788): Done scanning FHIR library, found 44 model entries in 124ms
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.toString, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29918: Lorg/apache/commons/io/IOUtils;.toString (Ljava/io/InputStream;)Ljava/lang/String;
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x0074
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.toString, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29919: Lorg/apache/commons/io/IOUtils;.toString (Ljava/io/Reader;)Ljava/lang/String;
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x0174
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29916: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/Reader;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x021b
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29916: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/Reader;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x022a
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.toByteArray, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29917: Lorg/apache/commons/io/IOUtils;.toByteArray (Ljava/io/InputStream;)[B
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x02ba
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29915: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/InputStream;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x0338
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29915: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/InputStream;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x0363
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.toString, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29919: Lorg/apache/commons/io/IOUtils;.toString (Ljava/io/Reader;)Ljava/lang/String;
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x038a
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29916: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/Reader;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x03b6
I/dalvikvm( 7788): Could not find method org.apache.commons.io.IOUtils.closeQuietly, referenced from method ca.uhn.fhir.rest.client.BaseClient.invokeClient
W/dalvikvm( 7788): VFY: unable to resolve static method 29916: Lorg/apache/commons/io/IOUtils;.closeQuietly (Ljava/io/Reader;)V
D/dalvikvm( 7788): VFY: replacing opcode 0x77 at 0x03d6
I/dalvikvm( 7788): Could not find method org.apache.http.conn.routing.HttpRoute.getLocalSocketAddress, referenced from method org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect
W/dalvikvm( 7788): VFY: unable to resolve virtual method 34042: Lorg/apache/http/conn/routing/HttpRoute;.getLocalSocketAddress ()Ljava/net/InetSocketAddress;
D/dalvikvm( 7788): VFY: replacing opcode 0x6e at 0x0020
D/dalvikvm( 7788): DexOpt: couldnot find static field Lorg/apache/http/message/BasicLineFormatter;.INSTANCE
W/dalvikvm( 7788): VFY: unable to resolve static field 14497 (INSTANCE) in Lorg/apache/http/message/BasicLineFormatter;
D/dalvikvm( 7788): VFY: replacing opcode 0x62 at 0x0008
W/dalvikvm( 7788): Exception Ljava/lang/NoSuchFieldError; thrown while initializing Lorg/apache/http/impl/io/DefaultHttpRequestWriterFactory;
W/dalvikvm( 7788): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lorg/apache/http/impl/conn/ManagedHttpClientConnectionFactory;
D/AndroidRuntime( 7788): Shutting down VM
W/dalvikvm( 7788): threadid=1: thread exiting with uncaught exception (group=0xa62ae288)
D/dalvikvm( 7788): GC_CONCURRENT freed 418K, 5% free 11959K/12487K, paused 1ms+10ms, total 16ms
E/AndroidRuntime( 7788): FATAL EXCEPTION: main
E/AndroidRuntime( 7788): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingHttpClientConnectionManager.java:494)
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:149)
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:109)
E/AndroidRuntime( 7788): at ca.uhn.fhir.rest.client.RestfulClientFactory.getHttpClient(RestfulClientFactory.java:98)
E/AndroidRuntime( 7788): at ca.uhn.fhir.rest.client.RestfulClientFactory.newGenericClient(RestfulClientFactory.java:166)
E/AndroidRuntime( 7788): at ca.uhn.fhir.context.FhirContext.newRestfulGenericClient(FhirContext.java:320)
E/AndroidRuntime( 7788): at xxxx.DHPClient.<init>(DHPClient.java:25)
E/AndroidRuntime( 7788): at xxxx.DisplayPatientActivity.onCreate(DisplayPatientActivity.java:19)
E/AndroidRuntime( 7788): at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 7788): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 7788): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 7788): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 7788): at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 7788): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 7788): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7788): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 7788): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 7788): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 7788): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 7788): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 7788): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 7788): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 7788): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:72)
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:84)
E/AndroidRuntime( 7788): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientConnectionFactory.java:59)
E/AndroidRuntime( 7788): ... 22 more
E/AndroidRuntime( 7788): Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
E/AndroidRuntime( 7788): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
E/AndroidRuntime( 7788): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
E/AndroidRuntime( 7788): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterFactory.java:46)
E/AndroidRuntime( 7788): ... 25 more
W/ActivityManager(  338):   Force finishing activity xxxx/.DisplayPatientActivity
W/ActivityManager(  338):   Force finishing activity xxxx/.MainActivity
W/ActivityManager(  338): Activity pause timeout for ActivityRecord{53759f74 xxxx/.DisplayPatientActivity}
W/EGL_emulation(  544): eglSurfaceAttrib not implemented

Himanshu

James Agnew

unread,
Jan 9, 2015, 4:38:40 PM1/9/15
to Himanshu Shrivastava, hapi...@googlegroups.com, Tom Wilson
Hmm interesting. Can you try adding the commons-codec JAR to your project?

Cheers,
James

Himanshu Shrivastava

unread,
Jan 9, 2015, 5:28:00 PM1/9/15
to James Agnew, hapi...@googlegroups.com, Tom Wilson
Tried it, same error. 

Regards,
Himanshu
Message has been deleted

sandesh....@gmail.com

unread,
Feb 2, 2015, 8:15:37 AM2/2/15
to hapi...@googlegroups.com
Any luck on Android??

James Agnew

unread,
Feb 2, 2015, 5:43:45 PM2/2/15
to sandesh....@gmail.com, hapi...@googlegroups.com, Tom Wilson
Hi Sandesh,

The current state of things is as follows: it looks like the model and parser now work fine on Android for both XML and JSON encoding. So it's possible to parse resources and interact with them successfully in your application.

The client unfortunately still doesn't work as a result of an incompatibility between the version of Apache HttpClient we are using and the version that Android supports. The last time I spoke to Himanshu (earlier in this thread) he was planning on working around this by implementing the HTTP calls manually in his own code (i.e. by using HAPI's parser but not its client module).

I do have some new information though- Someone here pointed out the other day that the Apache folks did release a special port of the newer HttpClient library that has been modified to work on Android. So this means that it may well be possible to use HAPI's client on Android after all! (details here https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html ).

If you (or anyone) is willing to test this, I can provide a binary to test with. Once we can get some confirmation that this is working, I'll add the Android HAPI binary to our main build so that it gets released with our regular release cycle, which would be awesome.

Cheers,
James



On Mon, Feb 2, 2015 at 8:14 AM, <sandesh....@gmail.com> wrote:

Any luck on Android???

daniel...@gmail.com

unread,
Dec 8, 2015, 7:30:53 AM12/8/15
to HAPI FHIR, sandesh....@gmail.com
Hi,
This old link leads to a page displaying a fairly consistent "This download link has expired."
Can I try to download a fix from somewhere else ?
Daniel
Reply all
Reply to author
Forward
0 new messages