Open SweetD3v opened 2 years ago
Having a similar issue. Anyone solved it?
I reproduced it while testing.
I used an interface which will show user a dialog with text that something is wrong with camera and press ok to restart. Then it'll restart the app on OK button press.
Hi, thank you for answering. I didn't quite understand what "Put open app ads." means? Also, where did you call the callback for when something is wrong with the camera?
Implement admob's "open app" ads to reproduce this bug easily. Where did I put the interface?
In the catch statement inside onStartBind()
try {
mCamera.createCaptureSession(outputSurfaces, new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession session) {
mSession = session;
task.trySetResult(null);
}
@Override
public void onConfigureFailed(@NonNull CameraCaptureSession session) {
Throwable cause = new RuntimeException(session.toString());
if (!task.getTask().isComplete()) {
task.trySetException(new CameraException(cause,
CameraException.REASON_FAILED_TO_START_PREVIEW));
} else {
throw new CameraException(CameraException.REASON_DISCONNECTED);
}
}
@Override
public void onReady(@NonNull CameraCaptureSession session) {
super.onReady(session);
}
}, null);
} catch (CameraAccessException e) {
// throw createCameraException(e);
//Here I put that
new Handler(Looper.getMainLooper())
.post(() -> {
if (CameraView.restartAppListener != null)
CameraView.restartAppListener.onRestartApp();
else Toast.makeText(getCallback().getContext(), "Camera error", Toast.LENGTH_SHORT).show();
});
}
In your camera activity,
@Override
public void onRestartApp() {
restartCameraDialog();
}
I'm getting too many crashes in this onStartBind() method. Anyone found any solution? @natario1 ?
Hi tech folks. I am getting this bug again and again in some devices. I tried many times to solve that, but it's still happening for some reason. Anyone having this issue? then please help me solve it.
To Reproduce
It's not reproduceable sadly, I am getting it from the play store app although I didn't apply any proguard.
XML layout
Logs
java.lang.NullPointerException: at com.otaliastudios.cameraview.engine.Camera2Engine.onStartBind (Camera2Engine.java) at com.otaliastudios.cameraview.engine.CameraEngine$2.call (CameraEngine.java:22) at com.otaliastudios.cameraview.engine.CameraEngine$2.call (CameraEngine.java) at com.otaliastudios.cameraview.engine.orchestrator.CameraStateOrchestrator$1.call (CameraStateOrchestrator.java) at com.otaliastudios.cameraview.engine.orchestrator.CameraStateOrchestrator$1.call (CameraStateOrchestrator.java) at com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator$2.run (CameraOrchestrator.java:4) at com.otaliastudios.cameraview.internal.WorkerHandler.run (WorkerHandler.java:10) at com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator.execute (CameraOrchestrator.java:13) at com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator.lambda$sync$0 (CameraOrchestrator.java:46) at com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator.$r8$lambda$HmE6GLzVomrx4z2yFPqPM3-OldU (CameraOrchestrator.java) at com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator$$InternalSyntheticLambda$0$8b677079dbbaae903a74c190d1ab73dae346936de4769c0e3a915f12c512d38e$0.run (CameraOrchestrator.java:2) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:236) at android.os.HandlerThread.run (HandlerThread.java:67)