dm77 / barcodescanner

Barcode Scanner Libraries for Android
Other
5.46k stars 1.43k forks source link

error while running app with basic implementation of Zxing #523

Closed ghost closed 4 years ago

ghost commented 4 years ago

W/CameraBase: An error occurred while connecting to camera: 0

djwillcaine commented 4 years ago

You need to specify that you need camera access in your AndroidManifest.xml file and might also need to request camera permission in your activity class.

AndroidManifest.xml

    <application>
        ...
        <uses-feature android:name="android.hardware.camera" />
        <uses-permission android:name="android.permission.CAMERA" />
    </applciation>

MainActivity.java

    protected void onCreate(Bundle savedIntanceState) {
        ...
        ActivityCompat.requestPermissions(this, new String[]{CAMERA}, REQUEST_CAMERA);
    }    

See this guide for a full example.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.