I am getting this error when i call cameraProvider.getAvailableConcurrentCameraInfos(). I tested this on two devices it works fine on samsung note 10+ but gives this error on sony xperia 1 mark 3.
this is the code:
for (List<CameraInfo> cameraInfoList : cameraProvider.getAvailableConcurrentCameraInfos()) {
for (CameraInfo cameraInfo : cameraInfoList) {
if (cameraInfo.getLensFacing() == CameraSelector.LENS_FACING_FRONT) {
cameraSelectorPrimary = cameraInfo.getCameraSelector();
} else if (cameraInfo.getLensFacing() == CameraSelector.LENS_FACING_BACK) {
cameraSelectorSecondary = cameraInfo.getCameraSelector();
}
}
if (cameraSelectorPrimary == null || cameraSelectorSecondary == null) {
// If either a primary or secondary selector wasn't found, reset both
// to move on to the next list of CameraInfos.
cameraSelectorPrimary = null;
cameraSelectorSecondary = null;
} else {
// If both primary and secondary camera selectors were found, we can
// conclude the search.
break;
}
}
FATAL EXCEPTION: main
Process: com.rbsol.project.lucided, PID: 10937
java.lang.IllegalArgumentException: No camera can be find for id: 5
at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator.lambda$createCameraSelectorById$0(Camera2CameraCoordinator.java:189)
at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator$$ExternalSyntheticLambda0.filter(Unknown Source:2)
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:128)
at androidx.camera.lifecycle.ProcessCameraProvider.getCameraInfoFromCameraSelector(ProcessCameraProvider.java:882)
at androidx.camera.lifecycle.ProcessCameraProvider.getAvailableConcurrentCameraInfos(ProcessCameraProvider.java:823)
at com.rbsol.project.Fragments.CameraXFragment.bindToLifecycleForConcurrentCamera(CameraXFragment.java:551)
at com.rbsol.project.Fragments.CameraXFragment.lambda$bindPreviewForPiP$7$com-rbsol-project-Fragments-CameraXFragment(CameraXFragment.java:510)
at com.rbsol.project.Fragments.CameraXFragment$$ExternalSyntheticLambda5.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:346)
at android.os.Looper.loop(Looper.java:475)
at android.app.ActivityThread.main(ActivityThread.java:7950)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
I am getting this error when i call cameraProvider.getAvailableConcurrentCameraInfos(). I tested this on two devices it works fine on samsung note 10+ but gives this error on sony xperia 1 mark 3.
this is the code:
FATAL EXCEPTION: main Process: com.rbsol.project.lucided, PID: 10937 java.lang.IllegalArgumentException: No camera can be find for id: 5 at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator.lambda$createCameraSelectorById$0(Camera2CameraCoordinator.java:189) at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator$$ExternalSyntheticLambda0.filter(Unknown Source:2) at androidx.camera.core.CameraSelector.filter(CameraSelector.java:128) at androidx.camera.lifecycle.ProcessCameraProvider.getCameraInfoFromCameraSelector(ProcessCameraProvider.java:882) at androidx.camera.lifecycle.ProcessCameraProvider.getAvailableConcurrentCameraInfos(ProcessCameraProvider.java:823) at com.rbsol.project.Fragments.CameraXFragment.bindToLifecycleForConcurrentCamera(CameraXFragment.java:551) at com.rbsol.project.Fragments.CameraXFragment.lambda$bindPreviewForPiP$7$com-rbsol-project-Fragments-CameraXFragment(CameraXFragment.java:510) at com.rbsol.project.Fragments.CameraXFragment$$ExternalSyntheticLambda5.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:346) at android.os.Looper.loop(Looper.java:475) at android.app.ActivityThread.main(ActivityThread.java:7950) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)