参考这个线程Using webdav on Android 可以结合使用 Sardine lib ( http://code.google.com/p/sardine/ ) 和 httpclientandroidlib ( http://code.google.com/p/ httpclientandroidlib/)。
但我不断收到 java.lang.VerifyError 异常。
我试图将 Sardine 库作为 jar 文件和 Eclipse-project 引用,但它始终相同。
如果我从 dalvikVM 读取消息,则在抛出异常之前,javax.xml.bind.JAXBContext.newInstance() 存在问题。但是我无法将 JAXB 库或源添加到项目中,因为我遇到了几个 Dx 错误:
[2011-10-28 16:48:40 - FireTablet] Dx 1 error; aborting
[2011-10-28 16:48:40 - FireTablet] Conversion to Dalvik format failed with error 1
[2011-10-28 16:49:00 - FireTablet] Dx
trouble processing "javax/xml/bind/PrintConversionEvent.class":
所以这不能成为解决方案。有谁知道如何在 android 上运行沙丁鱼库?
我非常感谢您的帮助!
例外:
10-28 16:21:33.602: I/Process(22992): Sending signal. PID: 22992 SIG: 9
10-28 16:30:59.005: I/dalvikvm(23056): Could not find method javax.xml.bind.JAXBContext.newInstance, referenced from method com.googlecode.sardine.util.SardineUtil.<clinit>
10-28 16:30:59.005: W/dalvikvm(23056): VFY: unable to resolve static method 20578: Ljavax/xml/bind/JAXBContext;.newInstance ([Ljava/lang/Class;)Ljavax/xml/bind/JAXBContext;
10-28 16:30:59.005: D/dalvikvm(23056): VFY: replacing opcode 0x71 at 0x000a
10-28 16:30:59.005: W/dalvikvm(23056): VFY: unable to resolve exception class 2678 (Ljavax/xml/bind/JAXBException;)
10-28 16:30:59.005: W/dalvikvm(23056): VFY: unable to find exception handler at addr 0x50
10-28 16:30:59.005: W/dalvikvm(23056): VFY: rejected Lcom/googlecode/sardine/util/SardineUtil;.<clinit> ()V
10-28 16:30:59.005: W/dalvikvm(23056): VFY: rejecting opcode 0x0d at 0x0050
10-28 16:30:59.005: W/dalvikvm(23056): VFY: rejected Lcom/googlecode/sardine/util/SardineUtil;.<clinit> ()V
10-28 16:30:59.005: W/dalvikvm(23056): Verifier rejected class Lcom/googlecode/sardine/util/SardineUtil;
10-28 16:30:59.005: D/AndroidRuntime(23056): Shutting down VM
10-28 16:30:59.005: W/dalvikvm(23056): threadid=1: thread exiting with uncaught exception (group=0x40015578)
10-28 16:30:59.009: E/AndroidRuntime(23056): FATAL EXCEPTION: main
10-28 16:30:59.009: E/AndroidRuntime(23056): java.lang.VerifyError: com.googlecode.sardine.util.SardineUtil
10-28 16:30:59.009: E/AndroidRuntime(23056): at com.googlecode.sardine.impl.SardineImpl.list(SardineImpl.java:339)
10-28 16:30:59.009: E/AndroidRuntime(23056): at hsr.ifs.firetablet.network.WebDavConnector.getFacilityNames(WebDavConnector.java:36)
我使用 Android API-Level 10 和 Java 1.6。