使用手电筒后无法使用条形码扫描仪
Posted
技术标签:
【中文标题】使用手电筒后无法使用条形码扫描仪【英文标题】:Unable to use barcodescanner after using torch 【发布时间】:2013-03-29 21:48:26 【问题描述】:我使用的是 Phonegap 2.5,并且我已经下载了最新版本的 BarcodeScanner 和 Torch。如果我使用手电筒然后尝试扫描图像,我会收到“抱歉,android 相机遇到问题。您可能需要重新启动设备。”。我在想手电筒并没有松开手电筒。如果您同意这是问题所在,任何人都知道强制它释放的方法吗?
03-29 16:36:53.094: I/dalvikvm-heap(15000): Grow heap (frag case) to 13.967MB for 3686416-byte allocation
03-29 16:36:53.104: W/MediaPlayer-JNI(15000): MediaPlayer finalized without being released
03-29 16:36:53.104: W/MediaPlayer-JNI(15000): MediaPlayer finalized without being released
03-29 16:36:53.104: W/MediaPlayer-JNI(15000): MediaPlayer finalized without being released
03-29 16:36:53.114: W/MediaPlayer-JNI(15000): MediaPlayer finalized without being released
03-29 16:36:53.114: W/MediaPlayer-JNI(15000): MediaPlayer finalized without being released
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.204: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.214: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.224: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.224: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x00000000
03-29 16:36:53.234: I/PlatformSupportManager(15000): Using implementation class com.google.zxing.client.android.common.executor.HoneycombAsyncTaskExecInterface of interface com.google.zxing.client.android.common.executor.AsyncTaskExecInterface for SDK 11
03-29 16:36:53.404: I/PlatformSupportManager(15000): Using implementation class com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface of interface com.google.zxing.client.android.camera.open.OpenCameraInterface for SDK 9
03-29 16:36:53.404: I/GingerbreadOpenCamera(15000): Opening camera #0
03-29 16:36:53.414: W/CaptureActivity(15000): Unexpected error initializing camera
03-29 16:36:53.414: W/CaptureActivity(15000): java.lang.RuntimeException: Fail to connect to camera service
03-29 16:36:53.414: W/CaptureActivity(15000): at android.hardware.Camera.native_setup(Native Method)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.hardware.Camera.<init>(Camera.java:340)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.hardware.Camera.open(Camera.java:302)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface.open(GingerbreadOpenCameraInterface.java:57)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.google.zxing.client.android.camera.CameraManager.openDriver(CameraManager.java:78)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.google.zxing.client.android.CaptureActivity.initCamera(CaptureActivity.java:701)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.google.zxing.client.android.CaptureActivity.surfaceCreated(CaptureActivity.java:384)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.SurfaceView.access$000(SurfaceView.java:86)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1842)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.Choreographer.doFrame(Choreographer.java:532)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.os.Handler.handleCallback(Handler.java:725)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.os.Handler.dispatchMessage(Handler.java:92)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.os.Looper.loop(Looper.java:137)
03-29 16:36:53.414: W/CaptureActivity(15000): at android.app.ActivityThread.main(ActivityThread.java:5234)
03-29 16:36:53.414: W/CaptureActivity(15000): at java.lang.reflect.Method.invokeNative(Native Method)
03-29 16:36:53.414: W/CaptureActivity(15000): at java.lang.reflect.Method.invoke(Method.java:525)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
03-29 16:36:53.414: W/CaptureActivity(15000): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
03-29 16:36:53.414: W/CaptureActivity(15000): at dalvik.system.NativeStart.main(Native Method)
03-29 16:36:53.424: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x01030042
03-29 16:36:53.424: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x01030042
03-29 16:36:53.434: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x01030044
03-29 16:36:53.434: W/asset(15000): deep redirect failure from 0x01030046 => 0x0208000c, defStyleAttr=0x01010084, defStyleRes=0x01030022, style=0x01030044
【问题讨论】:
我也有同样的问题,你有没有发现如何同时使用这两种方法? 是的。我今晚回家后会发布一个修复程序。我刚看到这个。对不起。 如果可以,那就太好了 【参考方案1】:尝试使用这个 phonegap 插件代替普通的条码扫描器。
https://github.com/Scandit/BarcodeScannerPlugin
【讨论】:
以上是关于使用手电筒后无法使用条形码扫描仪的主要内容,如果未能解决你的问题,请参考以下文章
无法在 Android 7 上使用 Monaca 条码扫描器插件