1

我正在使用zxing2.0库,android但我得到了这个例外:这是什么意思?

10-01 22:20:03.197: E/AndroidRuntime(345): java.lang.RuntimeException: Unable to start activity ComponentInfo{phoenix.metro.uis/com.google.zxing.client.android.CaptureActivity}: android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from drawable resource ID #0x7f050000
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.os.Looper.loop(Looper.java:123)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-01 22:20:03.197: E/AndroidRuntime(345):  at java.lang.reflect.Method.invokeNative(Native Method)
10-01 22:20:03.197: E/AndroidRuntime(345):  at java.lang.reflect.Method.invoke(Method.java:507)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-01 22:20:03.197: E/AndroidRuntime(345):  at dalvik.system.NativeStart.main(Native Method)
10-01 22:20:03.197: E/AndroidRuntime(345): Caused by: android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from drawable resource ID #0x7f050000
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.content.res.Resources.openRawResourceFd(Resources.java:860)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.google.zxing.client.android.BeepManager.buildMediaPlayer(BeepManager.java:97)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.google.zxing.client.android.BeepManager.updatePrefs(BeepManager.java:60)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.google.zxing.client.android.BeepManager.<init>(BeepManager.java:49)
10-01 22:20:03.197: E/AndroidRuntime(345):  at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:165)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-01 22:20:03.197: E/AndroidRuntime(345):  ... 11 more
10-01 22:20:03.197: E/AndroidRuntime(345): Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:427)
10-01 22:20:03.197: E/AndroidRuntime(345):  at android.content.res.Resources.openRawResourceFd(Resources.java:857)
10-01 22:20:03.197: E/AndroidRuntime(345):  ... 17 more
4

1 回答 1

1

同样的问题!我通过分步指南修复它,作者很好地解释了如何使用 zxing 库实现条形码阅读器/编码器。与原始手册的不同之处在于,他似乎使用了他的库版本,并在某些方面进行了修改(如他在文章中所示)以解决问题。按照他的指示下载他的 zxing 库。这个对我有用:

michalu zxing条码

于 2013-09-16T15:28:35.227 回答