我已將zxing庫集成到我的應用程序以掃描QR碼。正如我按下一個按鈕,啓動斑馬線掃描活動,應用程序崩潰,並給這些下列消息上的logcat,Android QR碼掃描使用Zxing庫變成崩潰
05-24 02:17:24.037: E/AndroidRuntime(516): FATAL EXCEPTION: main
05-24 02:17:24.037: E/AndroidRuntime(516): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.code.looknmove/com.google.zxing.client.android.CaptureActivity}: android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from
drawable resource ID #0x7f050000
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.os.Looper.loop(Looper.java:123)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 02:17:24.037: E/AndroidRuntime(516): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 02:17:24.037: E/AndroidRuntime(516): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 02:17:24.037: E/AndroidRuntime(516): at dalvik.system.NativeStart.main(Native Method)
05-24 02:17:24.037: E/AndroidRuntime(516): Caused by: android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from drawable resource ID #0x7f050000
05-24 02:17:24.037: E/AndroidRuntime(516): at android.content.res.Resources.openRawResourceFd(Resources.java:860)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.google.zxing.client.android.BeepManager.buildMediaPlayer(BeepManager.java:97)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.google.zxing.client.android.BeepManager.updatePrefs(BeepManager.java:60)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.google.zxing.client.android.BeepManager.<init>(BeepManager.java:49)
05-24 02:17:24.037: E/AndroidRuntime(516): at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:165)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-24 02:17:24.037: E/AndroidRuntime(516): ... 11 more
05-24 02:17:24.037: E/AndroidRuntime(516): Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
05-24 02:17:24.037: E/AndroidRuntime(516): at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:426)
05-24 02:17:24.037: E/AndroidRuntime(516): at android.content.res.Resources.openRawResourceFd(Resources.java:857)
05-24 02:17:24.037: E/AndroidRuntime(516): ... 17 more
我無法檢測到什麼實際問題。因此,需要一些幫助來解決問題,以便發現問題所在。
我只是遵循如何在android應用程序中集成zxing的教程。紐約,我會試一試,希望這能解決我的問題。謝謝。順便說一句,我已經添加了android項目作爲庫到我的應用程序並添加core.jar作爲庫到我的應用程序。我應該刪除所有這些? – Junaid
除了'android-integration'外,您不需要添加任何內容來使用Intents。上面的鏈接是你所需要的。 –
這是要求條碼掃描器必須像那樣安裝。但我的要求是,qrcode掃描必須在不安裝的情況下完成。它必須通過使用我的application.is來完成,請給出任何建議這個。 – user1213202