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

Front camera crashes #72

Closed sjayadeep closed 3 years ago

sjayadeep commented 3 years ago

Steps to Reproduce

Switching to front camera crashed the app

if (_sensor.value == Sensors.FRONT) { _sensor.value = Sensors.BACK; } else { _sensor.value = Sensors.FRONT; }

Actual results

uid: 10416 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x660 Cause: null pointer dereference x0 0000000000000660 x1 0000007e7e053cc0 x2 0000000000000000 x3 0000007ee7be7dff x4 0000007e7e053ca8 x5 000000000000004a x6 4055404906ff5140 x7 7f7f7f7f7f7f7f7f x8 0000000000000001 x9 71e2bf4945037b8f x10 0000000000430000 x11 000000000000001e x12 0000007ee7c63224 x13 0000007ee7c6326c x14 0000007ee7c632cc x15 0000000000000000 x16 0000007f6a7d9530 x17 0000007f6d41b760 x18 0000007e77570000 x19 0000000000000660 x20 0000000000000000 x21 0000007f6ca3b0a0 x22 0000007f6ca38028 x23 0000007ee6df629a x24 0000000000000004 x25 0000007e7e057020 x26 0000007edbc62cb0 x27 0000000000000001 x28 0000000000000000 x29 0000007e7e053d60 sp 0000007e7e053d40 lr 0000007f6a50df84 pc 0000007f6d41b760 backtrace:

00 pc 00000000000d7760 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock) (BuildId: 084c8a81b8c78e19cd9a1ff6208e77cf)

  #01 pc 000000000038cf80  /system/lib64/libhwui.so (android::SurfaceTexture::updateTexImage()+60) (BuildId: 0e7f75c3766e031530e154cd7d0a25e7)
  #02 pc 0000000000172d90  /system/lib64/libandroid_runtime.so (android::SurfaceTexture_updateTexImage(_JNIEnv*, _jobject*)+84) (BuildId: e3e429bb025cd55af3bf8324d4a5a8c7)
  #03 pc 0000000000aa2a9c  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+124) (BuildId: 1be0836f4fd69b30e55a3dd02927bd44ccc064b8)
  #04 pc 0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #05 pc 0000000000145fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #06 pc 00000000002e37d0  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #07 pc 00000000002dea30  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #08 pc 00000000005a3294  /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+424) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #09 pc 0000000000131914  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #10 pc 00000000003b3624  /system/framework/framework.jar (android.graphics.SurfaceTexture.updateTexImage)
  #11 pc 00000000005a122c  /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #12 pc 0000000000131814  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #13 pc 00000000003c984a  [anon:dalvik-classes.dex extracted in memory from /data/app/com.camera.bluehour-RxBaXNy7y30bjN9ZQX_VqA==/base.apk] (io.flutter.embedding.engine.renderer.SurfaceTextureWrapper.updateTexImage+14)
  #14 pc 00000000002b4ae4  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.17460956533834400288+240) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #15 pc 00000000005924d4  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #16 pc 0000000000140468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #17 pc 0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #18 pc 0000000000145fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #19 pc 00000000004b0ed8  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #20 pc 00000000004b2324  /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+424) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #21 pc 00000000003981b8  /apex/com.android.runtime/lib64/libart.so (art::JNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+628) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #22 pc 000000000036cc50  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+2368) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #23 pc 000000000035af30  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+72) (BuildId: b8abc9218340860606bcffe3818ec9c5)

About your device

Brand Model OS
Redmi k20 Pro MIUI 12.0.4, Android 10

anonUser-lab commented 3 years ago

this work for me ....

if (_sensor.value == Sensors.FRONT) { _sensor.value = Sensors.BACK; setState(() {}); } else { _sensor.value = Sensors.FRONT; setState(() {}); }

g-apparence commented 3 years ago

Avoid using setState as _sensor is a valueNotifier. CamerAwesome start the camera on the start of the widget, calling setState again and again will restart the camera and maybe crash your app.

_sensor.value  =  _sensor.value == Sensors.FRONT ? Sensors.BACK : Sensors.FRONT;

Let me know if that fix your error.

sjayadeep commented 3 years ago

No. Same error is happening.

g-apparence commented 3 years ago

Hello, could you give me more log plz. The logs you gave me contains nothing from our package.

Thank you

sjayadeep commented 3 years ago

Build fingerprint: 'Xiaomi/raphaelin/raphaelin:10/QKQ1.190825.002/V12.0.4.0.QFKINXM:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: 2021-01-16 16:02:05+0530 pid: 13250, tid: 13378, name: 1.raster >>> com.camera.my_package_name <<< uid: 10418 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x660 Cause: null pointer dereference x0 0000000000000660 x1 0000007e79435cc0 x2 0000000000000000 x3 0000007ee7be7dff x4 0000007e79435ca8 x5 000000000000004a x6 4055404906ff5140 x7 7f7f7f7f7f7f7f7f x8 0000000000000001 x9 71e2bf4945037b8f x10 0000000000430000 x11 000000000000001e x12 0000007ee7c63224 x13 0000007ee7c6326c x14 0000007ee7c632cc x15 0000000000000000 x16 0000007f6a7d9530 x17 0000007f6d41b760 x18 0000007e78216000 x19 0000000000000660 x20 0000000000000000 x21 0000007f6ca3b0a0 x22 0000007f6ca38028 x23 0000007ee6df629a x24 0000000000000004 x25 0000007e79439020 x26 0000007edbd1f8b0 x27 0000000000000001 x28 0000000000000000 x29 0000007e79435d60 sp 0000007e79435d40 lr 0000007f6a50df84 pc 0000007f6d41b760 backtrace:

00 pc 00000000000d7760 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock) (BuildId: 084c8a81b8c78e19cd9a1ff6208e77cf)

  #01 pc 000000000038cf80  /system/lib64/libhwui.so (android::SurfaceTexture::updateTexImage()+60) (BuildId: 0e7f75c3766e031530e154cd7d0a25e7)
  #02 pc 0000000000172d90  /system/lib64/libandroid_runtime.so (android::SurfaceTexture_updateTexImage(_JNIEnv*, _jobject*)+84) (BuildId: e3e429bb025cd55af3bf8324d4a5a8c7)
  #03 pc 0000000000aa2a9c  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+124) (BuildId: 1be0836f4fd69b30e55a3dd02927bd44ccc064b8)
  #04 pc 0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #05 pc 0000000000145fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #06 pc 00000000002e37d0  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #07 pc 00000000002dea30  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #08 pc 00000000005a3294  /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+424) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #09 pc 0000000000131914  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #10 pc 00000000003b3624  /system/framework/framework.jar (android.graphics.SurfaceTexture.updateTexImage)
  #11 pc 00000000005a122c  /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #12 pc 0000000000131814  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #13 pc 00000000003c984a  [anon:dalvik-classes.dex extracted in memory from /data/app/com.camera.bluehour-tq-QwWqRtA5lpaTnPWj53g==/base.apk] (io.flutter.embedding.engine.renderer.SurfaceTextureWrapper.updateTexImage+14)
  #14 pc 00000000002b4ae4  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.17460956533834400288+240) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #15 pc 00000000005924d4  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #16 pc 0000000000140468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #17 pc 0000000000137334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #18 pc 0000000000145fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #19 pc 00000000004b0ed8  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #20 pc 00000000004b2324  /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+424) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #21 pc 00000000003981b8  /apex/com.android.runtime/lib64/libart.so (art::JNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+628) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #22 pc 000000000036cc50  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+2368) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #23 pc 000000000035af30  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+72) (BuildId: b8abc9218340860606bcffe3818ec9c5)
  #24 pc 00000000012f5468  /data/app/com.camera.my_package_name-tq-QwWqRtA5lpaTnPWj53g==/lib/arm64/libflutter.so (BuildId: 08ad50a0e1d24035c43ff0b9928c5548a267c129)
  #25 pc bf80000000000000  <unknown>

Lost connection to device.

sjayadeep commented 3 years ago
CameraAwesome(
              // onPermissionsResult: _onPermissionsResult,
              selectDefaultSize: (availableSizes) {
                this._availableSizes = availableSizes;
                _photoSize = ValueNotifier(availableSizes[0]);
                return availableSizes[0];
              },
              captureMode: _captureMode,
              photoSize: _photoSize,
              sensor: _sensor,
              fitted: false,
              switchFlashMode: _switchFlash,
              zoom: _zoomNotifier,
              // onOrientationChanged: _onOrientationChange,
            ),

This is how I implemented the camera. Is there any problem for this?

g-apparence commented 3 years ago

hello, please share the code you made to switch camera.

g-apparence commented 3 years ago

68 seems related as the K20 pro has multiple lens

payalrparmar commented 3 years ago

unhandled exception: cameraexception(error, length=0; index=0)