我有一个Android库项目(由我编写,我有源代码),我在我的Android项目中使用 - 到目前为止这么好,没有问题。但是在那个库项目中我引用了一个外来的.jar文件(Bixolon移动打印机的SDK)并且它构建得很好,我可以在我的代码中引用SDK的方法。但是在运行时我得到了这个:
02-16 09:44:43.620: W/dalvikvm(25402): VFY: unable to resolve virtual method 2433: Lcom/bixolon/android/library/BxlService;.GetStatus ()I
02-16 09:44:43.625: W/dalvikvm(25402): VFY: unable to resolve virtual method 2433: Lcom/bixolon/android/library/BxlService;.GetStatus ()I
02-16 09:44:43.625: W/dalvikvm(25402): VFY: unable to resolve virtual method 2436: Lcom/bixolon/android/library/BxlService;.MarkFeed (I)I
02-16 09:44:43.625: W/dalvikvm(25402): VFY: unable to resolve virtual method 2428: Lcom/bixolon/android/library/BxlService;.Directio ([BI[B[I)I
02-16 09:44:43.630: W/dalvikvm(25402): VFY: unable to resolve virtual method 2437: Lcom/bixolon/android/library/BxlService;.PrintImage (Ljava/lang/String;III)I
02-16 09:44:43.630: W/dalvikvm(25402): VFY: unable to resolve virtual method 2433: Lcom/bixolon/android/library/BxlService;.GetStatus ()I
02-16 09:44:43.630: W/dalvikvm(25402): VFY: unable to resolve virtual method 2433: Lcom/bixolon/android/library/BxlService;.GetStatus ()I
02-16 09:44:43.630: W/dalvikvm(25402): VFY: unable to resolve virtual method 2433: Lcom/bixolon/android/library/BxlService;.GetStatus ()I
02-16 09:44:43.790: W/dalvikvm(25402): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
02-16 09:44:43.795: E/AndroidRuntime(25402): FATAL EXCEPTION: main
02-16 09:44:43.795: E/AndroidRuntime(25402): java.lang.NoClassDefFoundError: com.bixolon.android.library.BxlService
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.core.bluetooth.printer.bixolon.BixolonPrinter.connectToPrinter(BixolonPrinter.java:71)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.core.bluetooth.printer.PrintManager.findPrinter(PrintManager.java:101)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.core.bluetooth.printer.PrintManager.getPrinter(PrintManager.java:77)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.core.bluetooth.printer.PrintManager.printTestReceipt(PrintManager.java:53)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileoffences.ui.Printer$1.execute(Printer.java:40)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.ui.Dialog.executeActions(Dialog.java:271)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.ui.widgets.DynamicWidget.executeActions(DynamicWidget.java:152)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.ui.widgets.DynamicWidget.executeActions(DynamicWidget.java:138)
02-16 09:44:43.795: E/AndroidRuntime(25402): at de.softcon.mobileapp.framework.ui.widgets.Button$1.onClick(Button.java:67)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.view.View.performClick(View.java:2538)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.view.View$PerformClick.run(View.java:9152)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.os.Handler.handleCallback(Handler.java:587)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.os.Handler.dispatchMessage(Handler.java:92)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.os.Looper.loop(Looper.java:130)
02-16 09:44:43.795: E/AndroidRuntime(25402): at android.app.ActivityThread.main(ActivityThread.java:3691)
02-16 09:44:43.795: E/AndroidRuntime(25402): at java.lang.reflect.Method.invokeNative(Native Method)
02-16 09:44:43.795: E/AndroidRuntime(25402): at java.lang.reflect.Method.invoke(Method.java:507)
02-16 09:44:43.795: E/AndroidRuntime(25402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
02-16 09:44:43.795: E/AndroidRuntime(25402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
02-16 09:44:43.795: E/AndroidRuntime(25402): at dalvik.system.NativeStart.main(Native Method)
这让我想知道,如果我在我的Android库项目中引用的.jar正确部署...我有一个来自Bixolon的示例项目,它直接包含他们的.jar文件(我在Android库中引用的相同)项目),它工作正常。我已经确定在我自己的Android项目和我的Android库项目中是相同的(因为它在Bixolon提供的示例项目中定义)。所以我现在有点不知道问题是什么。不幸的是,我没有引用Bixolon SDK .jar的源文件 - 只是.jar。