我正在为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
答案 0 :(得分:1)
同样的问题!我通过一步一步的指南解决了这个问题,其中作者非常清楚地解释了如何使用zxing库实现条形码阅读器/编码器。与原始手册的不同之处在于,他似乎使用了他的版本库,在某些方面进行了修改(正如他在文章中所示)修复了问题。按照他的指示下载他的zxing库。它对我有用: