我有一个问题基本上从我开始尝试将外部jar添加到android项目中,在eclipse中一切似乎都很好,直到我尝试运行应用程序然后它崩溃在我尝试从导入调用类的地方.jar,错误如下。我试图找出错误,但我唯一得出的结论是,它与.jar文件有关,我尝试使用不包含在.apk中。
然而,当我尝试似乎与“java.lang.NoClassDefFoundError”问题匹配的解决方案时,没有任何反应或“转换为dalvik格式失败,错误1未知问题”。
我真的陷入了这一点,因为我已经尝试了我可能在互联网上找到的一切,但似乎没有任何效果。
10-28 21:43:49.824: E/dalvikvm(5017): Could not find class 'Protocols.Client', referenced from method com.example.smarterhouse.MainActivity.onClick
10-28 21:43:49.824: W/dalvikvm(5017): VFY: unable to resolve new-instance 6 (LProtocols/Client;) in Lcom/example/smarterhouse/MainActivity;
10-28 21:43:49.924: I/Adreno-EGL(5017): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: MINGHSUC_AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.047+PATCH[ES]_msm8960_refs/tags/AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.047__release_ENGG ()
10-28 21:43:49.924: I/Adreno-EGL(5017): OpenGL ES Shader Compiler Version: 17.01.12.SPL
10-28 21:43:49.924: I/Adreno-EGL(5017): Build Date: 03/25/14 Tue
10-28 21:43:49.924: I/Adreno-EGL(5017): Local Branch:
10-28 21:43:49.924: I/Adreno-EGL(5017): Remote Branch: refs/tags/AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.047
10-28 21:43:49.924: I/Adreno-EGL(5017): Local Patches: c29912293421482fd51b7f36b91ae584f9993d66 Add support for KIT_KAT
10-28 21:43:49.924: I/Adreno-EGL(5017): 4b5d3e5bcfa9d9563f740840d7258e1c1efa6d5a egl14: add EGL_ANDROID_image_crop support
10-28 21:43:49.924: I/Adreno-EGL(5017): Recon
10-28 21:43:51.706: W/dalvikvm(5017): threadid=1: thread exiting with uncaught exception (group=0x4168be18)
10-28 21:43:51.716: E/AndroidRuntime(5017): FATAL EXCEPTION: main
10-28 21:43:51.716: E/AndroidRuntime(5017): Process: com.example.smarterhouse, PID: 5017
10-28 21:43:51.716: E/AndroidRuntime(5017): java.lang.NoClassDefFoundError: Protocols.Client
10-28 21:43:51.716: E/AndroidRuntime(5017): at com.example.smarterhouse.MainActivity.onClick(MainActivity.java:79)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.view.View.performClick(View.java:4470)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.view.View$PerformClick.run(View.java:18593)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.os.Handler.handleCallback(Handler.java:733)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.os.Handler.dispatchMessage(Handler.java:95)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.os.Looper.loop(Looper.java:157)
10-28 21:43:51.716: E/AndroidRuntime(5017): at android.app.ActivityThread.main(ActivityThread.java:5867)
10-28 21:43:51.716: E/AndroidRuntime(5017): at java.lang.reflect.Method.invokeNative(Native Method)
10-28 21:43:51.716: E/AndroidRuntime(5017): at java.lang.reflect.Method.invoke(Method.java:515)
10-28 21:43:51.716: E/AndroidRuntime(5017): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
10-28 21:43:51.716: E/AndroidRuntime(5017): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
10-28 21:43:51.716: E/AndroidRuntime(5017): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
似乎问题就是我尝试使用的.jar是用java 8编译的,并且它与Android atm无法比较。
答案 1 :(得分:0)
根据我的意见,你应该复制.jar文件并将其粘贴到libs文件夹中,如果你使用eclipse ide。