Android Question QR reader targetSdkVersion = "26" does not work

rscheel

Well-Known Member
Licensed User
I am using the QRCodeReaderView library, but when using the android: targetSdkVersion = "26" sends me the following error, I know that with this SDK I have to use RuntimePermissions but it is a problem of the library not the permissions, someone knows if there is another library which can use with SDK 26, instead works perfectly with SDK 22


B4X:
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.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.hardware.camera")

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: Fail to connect to camera service
    at android.hardware.Camera.<init>(Camera.java:575)
    at android.hardware.Camera.open(Camera.java:404)
    at com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface.open(GingerbreadOpenCameraInterface.java:58)
    at com.google.zxing.client.android.camera.open.CameraManager.openDriver(CameraManager.java:81)
    at com.dlazaro66.qrcodereaderview.QRCodeReaderView.surfaceCreated(QRCodeReaderView.java:165)
    at android.view.SurfaceView.updateWindow(SurfaceView.java:618)
    at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:161)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2205)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6344)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
    at android.view.Choreographer.doCallbacks(Choreographer.java:686)
    at android.view.Choreographer.doFrame(Choreographer.java:621)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6186)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
 

rscheel

Well-Known Member
Licensed User
Why are you setting the targetSdkVersion to 26? It is most probably a mistake.

Have you requested the permission at runtime?

I only intended to make an app with that sdk, but, if I have set the permissions at runtime, the problem is of the library not the permissions.

Although now I came back to sdk 22, since there it works well.

Thank you.
 
Top