gpt4 book ai didi

android - NoClassDefFoundError:com.google.zxing.ResultMetadataType for zxing

转载 作者:行者123 更新时间:2023-11-29 20:31:39 28 4
gpt4 key购买 nike

我正在开发一个通过 ZXing 在 Android 上扫描条形码的应用程序。我关注这个tutorial .

但是当我运行我的应用程序时,出现 NoClassDefFoundError 并且应用程序已完成。

08-06 10:42:43.401: E/AndroidRuntime(10391): FATAL EXCEPTION: main
08-06 10:42:43.401: E/AndroidRuntime(10391): Process: com.foxconn.cnsbg.it.barcodescanner, PID: 10391
08-06 10:42:43.401: E/AndroidRuntime(10391): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/zxing/ResultMetadataType;
08-06 10:42:43.401: E/AndroidRuntime(10391): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:93)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.reflect.Constructor.newInstance(Native Method)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.Class.newInstance(Class.java:1572)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.ActivityThread.access$800(ActivityThread.java:149)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.os.Handler.dispatchMessage(Handler.java:102)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.os.Looper.loop(Looper.java:211)
08-06 10:42:43.401: E/AndroidRuntime(10391): at android.app.ActivityThread.main(ActivityThread.java:5333)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.reflect.Method.invoke(Native Method)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.reflect.Method.invoke(Method.java:372)
08-06 10:42:43.401: E/AndroidRuntime(10391): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
08-06 10:42:43.401: E/AndroidRuntime(10391): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
08-06 10:42:43.401: E/AndroidRuntime(10391): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.zxing.ResultMetadataType" on path: DexPathList[[zip file "/data/app/com.foxconn.cnsbg.it.barcodescanner-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
08-06 10:42:43.401: E/AndroidRuntime(10391): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
08-06 10:42:43.401: E/AndroidRuntime(10391): ... 15 more
08-06 10:42:43.401: E/AndroidRuntime(10391): Suppressed: java.lang.ClassNotFoundException: com.google.zxing.ResultMetadataType
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.Class.classForName(Native Method)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
08-06 10:42:43.401: E/AndroidRuntime(10391): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
08-06 10:42:43.401: E/AndroidRuntime(10391): ... 16 more
08-06 10:42:43.401: E/AndroidRuntime(10391): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

我在 Google 周围搜索并修复了 CaptureActivity 项目中的构建路径,例如: enter image description here

同时将 core-2.2.jar 添加到 CaptureActivity 项目和我的项目的 libs 文件夹中。我该如何解决这个问题?

最佳答案

看看这篇文章: Updating sdk got NoClassDefFoundError for zxing

引用到

“我不必将 jar 库放在 Assets 或 lib(s) 中,而只需在属性 -> Java 构建路径 -> “订购和导出”中勾选此 jar 的框(它在之前列出, 但未被选中)

您可能需要做一个项目 > 在此之后清理才能生效!”

这对我有用!

关于android - NoClassDefFoundError:com.google.zxing.ResultMetadataType for zxing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31846502/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com