akshay2211 / PixImagePicker

Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.
Apache License 2.0
860 stars 217 forks source link

"CameraXBasic: Use case binding failed" when mode = Mode.All #253

Closed luzlaura98 closed 1 year ago

luzlaura98 commented 2 years ago

I had a problem in my app but then I tested in the sample app. I have the same error, so I hope you can reproduce the bug easily. When mode is Mode.Picture or Mode.Video, its working fine.

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_image)

        val options = Options().apply {
            ratio = Ratio.RATIO_AUTO
            count = 1
            spanCount = 4
            path =  "collegiate/chat"
            isFrontFacing = false
            mode = Mode.All
            flash = Flash.Auto
            videoOptions = VideoOptions().apply {
                videoFrameRate
                videoDurationLimitInSeconds = 30
            }
        }
            addPixToActivity(R.id.fragmentContainerTest, options){
                when (it.status) {
                    PixEventCallback.Status.SUCCESS -> {
                        finish()
                    }
                    PixEventCallback.Status.BACK_PRESSED -> {
                        setResult(Activity.RESULT_CANCELED)
                    }
                }
            }
    }

Screenshots image

Smartphone:

Logcat:

io.ak1.pixsample E/CameraXBasic: Use case binding failed
    java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 1.  May be attempting to bind too many use cases. Existing surfaces: [] New configs: [androidx.camera.core.impl.PreviewConfig@70dd0ad, androidx.camera.core.impl.ImageCaptureConfig@944bfe2, androidx.camera.core.impl.VideoCaptureConfig@f88bf73]
        at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:278)
        at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:459)
        at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:288)
        at io.ak1.pix.helpers.CameraXManager.bindCameraUseCases(CameraXManager.kt:169)
        at io.ak1.pix.helpers.CameraXManager.setUpCamera$lambda-0(CameraXManager.kt:55)
        at io.ak1.pix.helpers.CameraXManager.lambda$saIgVXdcX8hBqOG6Idaj-FlC7bY(Unknown Source:0)
        at io.ak1.pix.helpers.-$$Lambda$CameraXManager$saIgVXdcX8hBqOG6Idaj-FlC7bY.run(Unknown Source:6)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6810)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
stale[bot] commented 1 year 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.