Android Question Failed to connect to camera service (QRCodeReader)

Denis De Pauli

Member
Licensed User
I've installed QRCodeReader, and for debug purposes I use a "old" S5 with android 6.0.1 (using SDK 24 or I've tried 26). When I use startScan I get this error on log

B4X:
java.lang.RuntimeException: Fail to connect to camera service
 at android.hardware.Camera.<init>(Camera.java:568)
 at android.hardware.Camera.open(Camera.java:405)
 at com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface.open(GingerbreadOpenCameraInterface.java:57)
 at com.google.zxing.client.android.camera.open.CameraManager.openDriver(CameraManager.java:77)
 at com.dlazaro66.qrcodereaderview.QRCodeReaderView.surfaceCreated(QRCodeReaderView.java:116)
 at android.view.SurfaceView.updateWindow(SurfaceView.java:712)
 at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:209)
 at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1014)
 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2510)
 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1437)
 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7397)
 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
 at android.view.Choreographer.doCallbacks(Choreographer.java:695)
 at android.view.Choreographer.doFrame(Choreographer.java:631)
 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
 at android.os.Handler.handleCallback(Handler.java:739)
 at android.os.Handler.dispatchMessage(Handler.java:95)
 at android.os.Looper.loop(Looper.java:158)
 at android.app.ActivityThread.main(ActivityThread.java:7224)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)


My manifest is
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
'AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
'AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.hardware.camera")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")

I've no idea why...
 

Denis De Pauli

Member
Licensed User
also.. if I use a newer version of SDK (27 or 28) it's impossibile to install (Errore durante l'analisi del pacchetto => Error in packet analisys) . this even if I change target SDK in manifest.
 
Upvote 0
Top