在具有附加权限的调试控制台中获取与剪贴板数据相关的警告错误

Nil*_*r F 3 flutter flutter-dependencies

我一直在从事一个涉及ESP32蓝牙和Flutter应用程序的项目。大约一周前,我的应用程序工作正常,没有这些警告消息,我在外面呆了一段时间,无法使用它,当我回来时,遇到了这条消息。该应用程序似乎工作正常,但每当我点击或单击某些内容时,我都会收到此“警告”消息。

如果我在 IOS 模拟器中运行该应用程序,它会正常工作而不会出现此错误,但在我的 Android 设备上运行时,会出现该错误。

这是我不断收到的消息:

\n
Launching lib/main.dart on LM G710 in debug mode...\nlib/main.dart:1\n\xe2\x9c\x93 Built build/app/outputs/flutter-apk/app-debug.apk.\nConnecting to VM Service at ws://127.0.0.1:00000/dasdj02D-m=/sas\nW/PlatformPlugin(23531): Attempted to get clipboard data that requires additional permission(s).\nW/PlatformPlugin(23531): See the exception details for which permission(s) are required, and consider adding them to your Android Manifest as described in:\nW/PlatformPlugin(23531): https://developer.android.com/guide/topics/permissions/overview\nW/PlatformPlugin(23531): java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/147669 from pid=23531, uid=10406 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()\nW/PlatformPlugin(23531):    at android.os.Parcel.createException(Parcel.java:1950)\nW/PlatformPlugin(23531):    at android.os.Parcel.readException(Parcel.java:1918)\nW/PlatformPlugin(23531):    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)\nW/PlatformPlugin(23531):    at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)\nW/PlatformPlugin(23531):    at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:698)\nW/PlatformPlugin(23531):    at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1460)\nW/PlatformPlugin(23531):    at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1404)\nW/PlatformPlugin(23531):    at io.flutter.plugin.platform.PlatformPlugin.getClipboardData(PlatformPlugin.java:295)\nW/PlatformPlugin(23531):    at io.flutter.plugin.platform.PlatformPlugin.access$700(PlatformPlugin.java:26)\nW/PlatformPlugin(23531):    at io.flutter.plugin.platform.PlatformPlugin$1.getClipboardData(PlatformPlugin.java:85)\nW/PlatformPlugin(23531):    at io.flutter.embedding.engine.systemchannels.PlatformChannel$1.onMethodCall(PlatformChannel.java:141)\nW/PlatformPlugin(23531):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)\nW/PlatformPlugin(23531):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)\nW/PlatformPlugin(23531):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)\nW/PlatformPlugin(23531):    at android.os.MessageQueue.nativePollOnce(Native Method)\nW/PlatformPlugin(23531):    at android.os.MessageQueue.next(MessageQueue.java:326)\nW/PlatformPlugin(23531):    at android.os.Looper.loop(Looper.java:160)\nW/PlatformPlugin(23531):    at android.app.ActivityThread.main(ActivityThread.java:6854)\nW/PlatformPlugin(23531):    at java.lang.reflect.Method.invoke(Native Method)\nW/PlatformPlugin(23531):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\nW/PlatformPlugin(23531):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试将其添加到我的 Android 清单中,但没有成功:

\n
<manifest xmlns:android="http://schemas.android.com/apk/res/android"\n    package="com.example.project">\n         <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>\n         <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>\n\n<application\n        android:requestLegacyExternalStorage="true">\n
Run Code Online (Sandbox Code Playgroud)\n

Mic*_*sey 5

这可能与剪贴板缓冲区中存在图像有关。

https://github.com/flutter/flutter/issues/65388#issuecomment-738539370

我遇到了同样的问题,当我将一些文本复制到手机上的剪贴板中时,调试消息就消失了。