Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
976 stars 256 forks source link

unlockFocus crashes the app #70

Closed anamauad closed 1 year ago

anamauad commented 3 years ago

Steps to Reproduce

Expected results

Actual results

About your device

Brand Model OS Notes
Xiaomi Redmi 9A Android 10 sdk 29 98 times in the last 7 days
Xiaomi Redmi 9 Android 10 sdk 29 60 times in the last 7 days
Xiaomi Redmi 6A Android 9 sdk 28 2 times in the last 7 days
Google Play Console Log ``` java.lang.IllegalStateException: at android.hardware.camera2.impl.CameraCaptureSessionImpl.checkNotClosed (CameraCaptureSessionImpl.java:834) at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture (CameraCaptureSessionImpl.java:164) at com.apparence.camerawesome.CameraPreview.unlockFocus (CameraPreview.java:31) at com.apparence.camerawesome.CameraPreview.a (CameraPreview.java:36) at com.apparence.camerawesome.CameraSession.a (CameraSession.java:22) at com.apparence.camerawesome.CameraPicture$2.onCaptureCompleted (CameraPicture.java:47) at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1 (CameraCaptureSessionImpl.java:640) at android.hardware.camera2.impl.-$$Lambda$CameraCaptureSessionImpl$1$OA1Yz_YgzMO8qcV8esRjyt7ykp4.run (Unknown Source:8) at android.os.Handler.handleCallback (Handler.java:914) at android.os.Handler.dispatchMessage (Handler.java:100) at android.os.Looper.loop (Looper.java:225) at android.app.ActivityThread.main (ActivityThread.java:7563) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:994) ```
g-apparence commented 3 years ago

unlockFocus cannot be called if you didn't take a photo. So I think the scenario is wrong. Can you double-check the scenario, please?

g-apparence commented 3 years ago

@anamauad

anamauad commented 3 years ago

I've updated the scenario.

* what is your compileSdkVersion in your build.gradle

* what is your targetSdkVersion in your  build.gradle
anamauad commented 3 years ago

It is crashing also on the following devices:

Brand Model OS Notes
Samsung Galaxy A10, A21s, J4, J6, S9 Android 10 20 times in the last 7 days
Samsung Galaxy A10, S8, S8+ Android 9 10 times in the last 7 days
Motorola E6 plus, Z Play Android 9 2 times in the last 7 days

In response to your question "unlockFocus cannot be called if you didn't take a photo.", it crashes the app right after pressing the shutter button.

mwvarela commented 2 years ago

We are having this error on Xiaomi Redmi 9A

Fatal Exception: java.lang.IllegalStateException: Session has been closed; further changes are illegal. at android.hardware.camera2.impl.CameraCaptureSessionImpl.checkNotClosed(CameraCaptureSessionImpl.java:834) at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:164) at com.apparence.camerawesome.CameraPreview.unlockFocus(CameraPreview.java:31) at com.apparence.camerawesome.CameraPreview.onStateChanged(CameraPreview.java:36) at com.apparence.camerawesome.CameraSession.setState(CameraSession.java:22) at com.apparence.camerawesome.CameraPicture$2.onCaptureCompleted(CameraPicture.java:47) at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1(CameraCaptureSessionImpl.java:640) at android.hardware.camera2.impl.-$$Lambda$CameraCaptureSessionImpl$1$OA1Yz_YgzMO8qcV8esRjyt7ykp4.run(-.java:8) at android.os.Handler.handleCallback(Handler.java:914) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994)

g-apparence commented 1 year ago

This should be fixed with the reworked version #150