okadan / flutter-nfc-manager

A Flutter plugin for accessing the NFC features on Android and iOS.
https://pub.dev/packages/nfc_manager
MIT License
200 stars 131 forks source link

Wrote stack traces to tombstoned #124

Open batoul-alani opened 1 year ago

batoul-alani commented 1 year ago

On some android devices which have Android 12 and above, when we try to use the lock function we face an error :

I/devlopment.knot(24699): Wrote stack traces to tombstoned F/crash_dump64(29183): crash_dump.cpp:539] failed to attach to thread 560: Permission denied F/crash_dump64(29197): crash_dump.cpp:539] failed to attach to thread 990: Operation not permitted WhatsApp Image 2023-02-07 at 3 14 49 PM

and we can't turn off The Nfc on the device until about 1 minute, then this error is shown:

E/flutter (24699): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, android.os.DeadObjectException, null, java.lang.RuntimeException: android.os.DeadObjectException E/flutter (24699): at android.nfc.Tag.getTagService(Tag.java:391) E/flutter (24699): at android.nfc.tech.BasicTagTechnology.isConnected(BasicTagTechnology.java:63) E/flutter (24699): at android.nfc.tech.Ndef.isConnected(Ndef.java:71) E/flutter (24699): at io.flutter.plugins.nfcmanager.NfcManagerPlugin.handleNfcDisposeTag(NfcManagerPlugin.kt:140) E/flutter (24699): at io.flutter.plugins.nfcmanager.NfcManagerPlugin.onMethodCall(NfcManagerPlugin.kt:68) E/flutter (24699): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258) E/flutter (24699): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) E/flutter (24699): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) E/flutter (24699): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) E/flutter (24699): at android.os.Handler.handleCallback(Handler.java:942) E/flutter (24699): at android.os.Handler.dispatchMessage(Handler.java:99) E/flutter (24699): at android.os.Looper.loopOnce(Looper.java:226) E/flutter (24699): at android.os.Looper.loop(Looper.java:313) E/flutter (24699): at android.app.ActivityThread.main(ActivityThread.java:8741) E/flutter (24699): at java.lang.reflect.Method.invoke(Native Method) E/flutter (24699): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) E/flutter (24699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) E/flutter (24699): Caused by: android.os.DeadObjectException E/flutter (24699): at android.os.BinderProxy.transactNative(Native Method) E/flutter (24699): at android.os.BinderProxy.transact(BinderProxy.java:653) E/flutter (24699): at android.nfc.INfcTag$Stub$Proxy.isTagUpToDate(INfcTag.java:807) E/flutter (24699): at android.nfc.Tag.getTagService(Tag.java:382) E/flutter (24699): ... 16 more E/flutter (24699): ) E/flutter (24699): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7) E/flutter (24699): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:315:18) E/flutter (24699): <asynchronous suspension> E/flutter (24699): #2 NfcManager._handleOnDiscovered (package:nfc_manager/src/nfc_manager/nfc_manager.dart:105:5) E/flutter (24699): <asynchronous suspension> WhatsApp Image 2023-02-07 at 3 14 56 PM WhatsApp Image 2023-02-07 at 3 14 53 PM

we try to add these lines on the AndroidManifest.xml file to fix the issue:

        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
            <data android:mimeType="mime/type" />
        </intent-filter>

but nothing has changed and we are still on this error trying to fix the issue, any solutions to fix this issue?

also, we try to use the example project on the plugin but it has the same problem.

Flutter Doctor: WhatsApp Image 2023-02-07 at 3 39 42 PM

batoul-alani commented 1 year ago

we discover that this issue is founded on Android 13 only, but still need any solution to fix