我在Android應用程序中使用Guava r09庫,但在1.6版本中使用它時出現以下錯誤。這有點奇怪,因爲它在1.5中正常工作。此外,「未找到」的方法非常明確。我也試過包括jsr305.jar文件,但這仍然不起作用。使用Google Guava和Android 1.6
感謝任何幫助,在沒有番石榴的情況下在Java中進行I/O操作是非常痛苦的。
這是代碼:
String timestamp = CharStreams.toString(
CharStreams.newReaderSupplier(timestampFile, Charset.forName("UTF-8")));
這是例外:
05-08 12:16:41.163: ERROR/dalvikvm(335): Could not find method com.google.common.io.LineReader.<init>, referenced from method com.google.common.io.CharStreams.readFirstLine
05-08 12:16:41.163: WARN/dalvikvm(335): VFY: unable to resolve direct method 6798: Lcom/google/common/io/LineReader;.<init> (Ljava/lang/Readable;)V
05-08 12:16:41.163: WARN/dalvikvm(335): VFY: rejecting opcode 0x70 at 0x0009
05-08 12:16:41.163: WARN/dalvikvm(335): VFY: rejected Lcom/google/common/io/CharStreams;.readFirstLine (Lcom/google/common/io/InputSupplier;)Ljava/lang/String;
05-08 12:16:41.163: WARN/dalvikvm(335): Verifier rejected class Lcom/google/common/io/CharStreams;
05-08 12:16:41.163: DEBUG/AndroidRuntime(335): Shutting down VM
05-08 12:16:41.163: WARN/dalvikvm(335): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
05-08 12:16:41.173: ERROR/AndroidRuntime(335): Uncaught handler: thread main exiting due to uncaught exception
05-08 12:16:41.183: ERROR/AndroidRuntime(335): java.lang.VerifyError: com.google.common.io.CharStreams
at com.triposo.droidguide.rometest.LocationStoreInstaller.install(LocationStoreInstaller.java:33)
at com.triposo.droidguide.rometest.SplashActivity.onStart(SplashActivity.java:58)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1205)
at android.app.Activity.performStart(Activity.java:3520)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2373)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
at android.app.ActivityThread.access$2100(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
什麼代碼導致此問題? – 2011-05-14 05:15:57
我編輯了問題以添加代碼。 – 2011-05-18 07:11:14