Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When layout cardformfield render second time on screen #1940

Open
mohsinnaqvi606 opened this issue Sep 25, 2024 · 1 comment
Open

When layout cardformfield render second time on screen #1940

mohsinnaqvi606 opened this issue Sep 25, 2024 · 1 comment

Comments

@mohsinnaqvi606
Copy link

mohsinnaqvi606 commented Sep 25, 2024

I used CardFormField in the bottomsheet, when I open and close the bottomsheet too frequently, App is crashing.

Here is my code

  cardFieldButtonSheet() {
    showModalBottomSheet(
      isScrollControlled: true,
      context: Get.context!,
      backgroundColor: Colors.white,
      builder: (context) {
        return Container(
          padding: EdgeInsets.fromLTRB(
              16, 16, 16, 16 + MediaQuery.of(Get.context!).viewInsets.bottom),
          decoration: const BoxDecoration(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(24),
              topRight: Radius.circular(24),
            ),
          ),
          child: SingleChildScrollView(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      'Add Payment',
                      style: w700(size: 16, color: Colors.black),
                    ),
                    IconButton(
                      onPressed: () {
                        Get.back();
                      },
                      icon: Icon(
                        Icons.close,
                        color: ThemeHelper.textColor,
                      ),
                    )
                  ],
                ),
                CardFormField(
                  controller: cardFormEditController,
                  style: CardFormStyle(
                    placeholderColor: ThemeHelper.textColor,
                    cursorColor: ThemeHelper.textColor,
                  ),
                ),
                Obx(
                  () => CustomTxtBtn(
                    title: 'Add Payment Method',
                    backgroundColor: ThemeHelper.secondary,
                    showLoader: isLoading.value,
                    onPressed: () {
                      saveCard();
                    },
                  ),
                )
              ],
            ),
          ),
        );
      },
    );
  }

Here are logs

E/flutter (29928): [ERROR:flutter/fml/platform/android/jni_util.cc(206)] java.lang.IllegalStateException: The Android view returned from PlatformView#getView() was already added to a parent view.
E/flutter (29928): 	at io.flutter.plugin.platform.PlatformViewsController.initializePlatformViewIfNeeded(PlatformViewsController.java:1133)
E/flutter (29928): 	at io.flutter.plugin.platform.PlatformViewsController.onDisplayPlatformView(PlatformViewsController.java:1192)
E/flutter (29928): 	at io.flutter.embedding.engine.FlutterJNI.onDisplayPlatformView(FlutterJNI.java:1458)
E/flutter (29928): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (29928): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (29928): 	at android.os.Looper.loopOnce(Looper.java:162)
E/flutter (29928): 	at android.os.Looper.loop(Looper.java:294)
E/flutter (29928): 	at android.app.ActivityThread.main(ActivityThread.java:8177)
E/flutter (29928): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29928): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/flutter (29928): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/flutter (29928): 
F/flutter (29928): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1725)] Check failed: fml::jni::CheckException(env). 
F/libc    (29928): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 29928 (a.adara_app_hub), pid 29928 (a.adara_app_hub)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:14/UE1A.230829.036.A2/11596452:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-09-20 09:24:36.020164700+0500
Process uptime: 129s
Cmdline: com.adara.adara_app_hub
pid: 29928, tid: 29928, name: a.adara_app_hub  >>> com.adara.adara_app_hub <<<
uid: 10208
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1725)] Check failed: fml::jni::CheckException(env). '
    x0  0000000000000000  x1  00000000000074e8  x2  0000000000000006  x3  0000007fe8ca9880
    x4  6d602e6c716e6573  x5  6d602e6c716e6573  x6  6d602e6c716e6573  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  0000007ef1052090  x10 0000000000000001  x11 0000007ef10a5058
    x12 0000000000008467  x13 000000000000007e  x14 0000007fe8ca8740  x15 00000120129f0edd
    x16 0000007ef1112d08  x17 0000007ef10e6e90  x18 0000007f16792000  x19 00000000000074e8
    x20 00000000000074e8  x21 00000000ffffffff  x22 b400007e5c757d10  x23 b400007e1c78bea8
    x24 000000000000002a  x25 00000000000002fe  x26 0000000000000013  x27 0000007fe8ca9b78
    x28 0000007f158b5049  x29 0000007fe8ca9900
    lr  0000007ef10969b8  sp  0000007fe8ca9860  pc  0000007ef10969e4  pst 0000000000001000
61 total frames
backtrace:
      #00 pc 00000000000669e4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
      #01 pc 0000000001cef21c  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #02 pc 0000000001d19bd4  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #03 pc 0000000001cfe2a4  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #04 pc 00000000024a982c  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #05 pc 000000000214a514  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #06 pc 0000000002149fd8  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #07 pc 0000000002148e7c  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #08 pc 0000000002149848  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #09 pc 000000000214b430  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #10 pc 00000000021492e4  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #11 pc 0000000002149080  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #12 pc 0000000002158214  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #13 pc 0000000001d1a7d0  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #14 pc 0000000001d20360  /data/app/~~IvY2R4Nj8zsjuLToJKNGGw==/com.adara.adara_app_hub-KsUK1fdQTPKUiuA7KAdEyw==/base.apk!libflutter.so (offset 0x2028000) (BuildId: 38b2e4789cc37a87ec67647fa65c44ef8b714721)
      #15 pc 00000000000102a4  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+408) (BuildId: 4ad4af87e8ab16b872cdbdaf84188131)
      #16 pc 0000000000183604  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: c741d6d101847b558f8cdb0633f23335)
      #17 pc 0000000000377030  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #18 pc 00000000003605a4  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #19 pc 00000000004906b4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+1248) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #20 pc 000000000050a5d4  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+2380) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #21 pc 00000000003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #22 pc 00000000001fce24  /system/framework/framework.jar (android.os.MessageQueue.next+0)
      #23 pc 000000000037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.1377403774332988508)+356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #24 pc 000000000049120c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+4152) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #25 pc 0000000000509f94  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+780) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #26 pc 00000000003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #27 pc 00000000001fbe08  /system/framework/framework.jar (android.os.Looper.loopOnce+0)
      #28 pc 000000000037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.1377403774332988508)+356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #29 pc 000000000049120c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+4152) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #30 pc 000000000050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #31 pc 00000000003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #32 pc 00000000001fc57c  /system/framework/framework.jar (android.os.Looper.loop+0)
      #33 pc 000000000037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.1377403774332988508)+356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #34 pc 000000000049120c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+4152) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #35 pc 000000000050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #36 pc 00000000003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #37 pc 00000000001c3970  /system/framework/framework.jar (android.app.ActivityThread.main+0)
      #38 pc 000000000037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.1377403774332988508)+356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #39 pc 000000000037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #40 pc 0000000000377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #41 pc 0000000000360880  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #42 pc 000000000026a904  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+780) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #43 pc 000000000026a5e8  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #44 pc 0000000000377030  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #45 pc 00000000003605a4  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #46 pc 00000000004906b4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+1248) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #47 pc 0000000000509f94  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+780) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #48 pc 00000000003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #49 pc 000000000050cd00  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+0)
      #50 pc 000000000037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.1377403774332988508)+356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #51 pc 000000000037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #52 pc 0000000000377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #53 pc 0000000000758f58  /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3160) (BuildId: d78a45b435dbd99c4526a33e3674ae4ee6ada328)
      #54 pc 0000000000360880  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #55 pc 00000000004944c4  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+516) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #56 pc 0000000000553528  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+112) (BuildId: b10f5696fea1b32039b162aef3850ed3)
      #57 pc 00000000000e1ab4  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+104) (BuildId: c741d6d101847b558f8cdb0633f23335)
      #58 pc 00000000000ed7c4  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+840) (BuildId: c741d6d101847b558f8cdb0633f23335)
      #59 pc 000000000001052c  /system/bin/app_process64 (main+1240) (BuildId: d5d56c38dabc17bd99cd0a7e469056fb)
      #60 pc 000000000005f610  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+104) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
Lost connection to device.
the Dart compiler exited unexpectedly.

Check This video for better understanding
https://github.com/user-attachments/assets/5cf94c15-bfd2-4689-bfff-14bf4c710532

Originally posted by @mohsinnaqvi606 in #1585 (comment)

@remonh87
Copy link
Member

remonh87 commented Oct 4, 2024

@jonasbark can you take a look at this? It seems that we probably not destroy views correctly in Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants