Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black Screen, no Camera Preview #299

Closed
dhruv2601 opened this issue May 22, 2017 · 8 comments
Closed

Black Screen, no Camera Preview #299

dhruv2601 opened this issue May 22, 2017 · 8 comments

Comments

@dhruv2601
Copy link

dhruv2601 commented May 22, 2017

Description of the problem:

When I am using the below code to access the barcode scanner camera then as in the below image, a black screen covers what should have been the camera instead.
I have made sure that the camera permission is granted.

` <com.journeyapps.barcodescanner.DecoratedBarcodeView
android:id="@+id/scanner"
android:layout_width="match_parent"
android:layout_height="200dp"
app:zxing_preview_scaling_strategy="centerCrop"
app:zxing_use_texture_view="false" />

<com.journeyapps.barcodescanner.ViewfinderView
    android:id="@+id/zxing_viewfinder_view"
    android:layout_width="match_parent"
    android:layout_height="200dp" />

`

My need is to reduce the size of the scanning camera to a given size ex -> as in the figure, so if there is a way around that, then please mention that.

screenshot_20170522-230250

Which library version are you using? 3.5.0.

Logs:

05-23 00:37:34.082 3062-3103/com.raywenderlich.alltherages E/CameraInstance: Failed to open camera
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:568)
at android.hardware.Camera.open(Camera.java:405)
at com.google.zxing.client.android.camera.open.OpenCameraInterface.open(OpenCameraInterface.java:83)
at com.journeyapps.barcodescanner.camera.CameraManager.open(CameraManager.java:138)
at com.journeyapps.barcodescanner.camera.CameraInstance$3.run(CameraInstance.java:190)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)

@passiondroid
Copy link

How did you solved this issue ?

@micsha123
Copy link

That seems to be Camera API 2 - it's not supported yet by this library.

@tejas2
Copy link

tejas2 commented Mar 26, 2019

Hey @dhruv2601, How did you fix this issue?

@ikurek
Copy link

ikurek commented Jul 24, 2019

I'm having the same issue on Android 9

@revrkk
Copy link

revrkk commented Dec 11, 2019

I faced the same issue. But in my case, I got the following from the logs

W/TextureView: A TextureView or a subclass can only be used with hardware acceleration enabled.

So I just set the hardware acceleration for the activity in the manifest file. and It worked.!

android:hardwareAccelerated="true"

@johndev8964
Copy link

@OverRide
protected void onResume() {
super.onResume();
barcodeView.resume();
}

@OverRide
protected void onPause() {
super.onPause();
barcodeView.pause();
}

Please add this, you can open a camera view.

@TheSnowfield
Copy link

@OverRide
protected void onResume() {
super.onResume();
barcodeView.resume();
}

@OverRide
protected void onPause() {
super.onPause();
barcodeView.pause();
}

Please add this, you can open a camera view.

It works like a charm. Best thanks!

@alexvarboffin
Copy link

!!! android:hardwareAccelerated="true" !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants