How to use Sardine in Android

1,393 views
Skip to first unread message

Harry Lu

unread,
Jul 27, 2012, 8:42:48 PM7/27/12
to sardi...@googlegroups.com

Greetings.

I am a developer from China, currently working on a webDAV client for Android platform.
And I do have some serious problems to make it work, hope that someone here can point out a way
for me to fix.

I have used it on Desktop environment, which have full JDK installed.
However, it is not the case on Android platform.


What I have done:
1)  I put the source code on Sardine in my Android project (for easy debugging)
2)  I put {commons-codec-1.4.jar, commons-logging-1.1.1.jar, httpclient-4.1.2.jar,httpcore-
4.1.3.jar, slf4j-api-1.6.2.jar} as library. These are the library in the original Sardine project.

But it does not work. Lots of errors.

I googled around, and found that it needs jaxb.jar. I got the jar file, and only 1 error left.
It is in SardineUtil.java, in the last line.

@SuppressWarnings("unchecked")
    public static <T> T unmarshal(InputStream in) throws IOException{
         ....
         ....

         return (T) unmarshaller.unmarshal(new SAXSource(reader, new InputSource(in)));   // the error line
}

And Eclipse gives me a hint : 

"The type javax.xml.stream.XMLStreamReader cannot be resolved. It is indirectly referenced from required .class files"

I googled, people on the net say it needs a jsr173.jar. I found it, too.
Put it back in the library, and the error in SardineUtil.java has gone.

BUT:

SardineImpl.java has a few errors because of having jsr173.jar as library.
And it states the arguments not applicable.

I stuck here for a whole day. Tried everything out.
Hope that someone have time drop me a line and point out how it is possible for me to fix this.

P.S. I tried some other Sardine Android libraries too, they have some workarounds, but do not work well enough to use in production.

The same test case, it will pass on Sardine desktop version( the one available on google code), but will not pass for other android portings, as
they are not 100% complete.

Looking forwarding for a point-out.

Regards,
-Harry.

TcBoY

unread,
Aug 2, 2012, 10:22:10 AM8/2/12
to sardi...@googlegroups.com
Which "other" sardine android libraries that have some workarounds?
i am interested

Harry Lu

unread,
Aug 2, 2012, 10:30:38 AM8/2/12
to sardi...@googlegroups.com
Sardine is not going to work, not "other" sardine libs.
So far there is no stable and production sardine android lib.

Instead, you can use this one:
http://ashimita.blogspot.kr/2011/05/using-jackrabbit-as-webdav-client-for.html

I am using it now after trying 3 days of *-sardine out.
The lib above works and stable, please use it.

Hope that someone would port Sardine to android.

TcBoY

unread,
Aug 3, 2012, 2:27:06 PM8/3/12
to sardi...@googlegroups.com

Harry Lu

unread,
Aug 5, 2012, 12:08:45 PM8/5/12
to sardi...@googlegroups.com
Do you mean this one "will work" or this one "works".
I tried the library out before trying any other libraries, i did not work for me.

Does it work for you? If yes, very good to know.

yeo hui shyong

unread,
Aug 5, 2012, 10:28:01 PM8/5/12
to sardi...@googlegroups.com
yup it works for me
but it is actually not full sardine
becoz there are alot of errors when u import sardine to android
the code owner just comment out those uncompatible code
and change to simple-xml
So it works, somehow, maybe no SSL supported
Reply all
Reply to author
Forward
0 new messages