颤振失去与新 USB 设备的连接

Posted

技术标签:

【中文标题】颤振失去与新 USB 设备的连接【英文标题】:Flutter Lost connection to device with new USB 【发布时间】:2020-08-21 16:18:04 【问题描述】:

所以我的 Flutter 应用程序工作正常,但不幸的是,我的 USB 损坏了。所以我买了两个新的USB。但从那时起,每次运行我的项目时,我都会收到以下错误:

Launching lib\main.dart on RMX1801 in debug mode...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity(32205): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(32205): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(32205): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
W/FlutterEngine(32205): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@4bc4669) but could not find and invoke the GeneratedPluginRegistrant.
D/FlutterActivityAndFragmentDelegate(32205): Attaching FlutterEngine to the Activity that owns this Fragment.
E/ANR_LOG (32205): >>> msg's executing time is too long
E/ANR_LOG (32205): Blocked msg =  when=-3s964ms what=159 target=android.app.ActivityThread$H obj=android.app.servertransaction.ClientTransaction@3a98be19  , cost  = 2508 ms
E/ANR_LOG (32205): >>>Current msg List is:
E/ANR_LOG (32205): Current msg <1>  =  when=-3s416ms what=149 target=android.app.ActivityThread$H obj=android.os.BinderProxy@838d0b7 
E/ANR_LOG (32205): Current msg <2>  =  when=-2s754ms what=131 target=android.app.ActivityThread$H obj=android.app.ActivityThread$ProviderRefCount@bb74efe 
E/ANR_LOG (32205): Current msg <3>  =  when=-2s550ms what=0 target=com.google.android.gms.internal.firebase_auth.zzj callback=com.google.firebase.auth.zzm 
E/ANR_LOG (32205): Current msg <4>  =  when=-2s480ms what=0 target=android.app.ActivityThread$H callback=android.app.LoadedApk$ServiceDispatcher$RunConnection 
E/ANR_LOG (32205): Current msg <5>  =  when=-2s319ms what=0 target=android.app.ActivityThread$H callback=android.app.LoadedApk$ServiceDispatcher$RunConnection 
E/ANR_LOG (32205): Current msg <6>  =  when=-1s894ms what=1 target=android.os.AsyncTask$InternalHandler obj=android.os.AsyncTask$AsyncTaskResult@d92365f 
E/ANR_LOG (32205): Current msg <7>  =  when=-340ms what=131 target=android.app.ActivityThread$H obj=android.app.ActivityThread$ProviderRefCount@4c48ac 
E/ANR_LOG (32205): Current msg <8>  =  when=-105ms what=0 target=android.app.ActivityThread$H callback=android.app.LoadedApk$ServiceDispatcher$RunConnection 
E/ANR_LOG (32205): Current msg <9>  =  when=-97ms what=0 target=android.os.Handler callback=io.flutter.embedding.android.FlutterActivityAndFragmentDelegate$2 
E/ANR_LOG (32205): Current msg <10>  =  when=-70ms what=0 target=android.view.ViewRootImpl$ViewRootHandler callback=android.view.ViewRootImpl$4 
E/ANR_LOG (32205): >>>CURRENT MSG DUMP OVER<<<
D/FlutterView(32205): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@4bc4669
W/Ads     (32205): Update ad debug logging enablement as false
W/.vedx.mentor10(32205): create CommonDcsHelper
W/.vedx.mentor10(32205): cacheJniMembers success
W/.vedx.mentor10(32205): constructJavaHashMap: start
W/.vedx.mentor10(32205): constructJavaHashMap: end
W/.vedx.mentor10(32205): sendCommonDcs: start
W/.vedx.mentor10(32205): sendCommonDcs: end
W/.vedx.mentor10(32205): Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (light greylist, reflection)
W/.vedx.mentor10(32205): constructJavaHashMap: start
W/.vedx.mentor10(32205): constructJavaHashMap: end
W/.vedx.mentor10(32205): sendCommonDcs: start
W/.vedx.mentor10(32205): sendCommonDcs: end
W/.vedx.mentor10(32205): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (light greylist, reflection)
W/.vedx.mentor10(32205): constructJavaHashMap: start
W/.vedx.mentor10(32205): constructJavaHashMap: end
W/.vedx.mentor10(32205): sendCommonDcs: start
W/.vedx.mentor10(32205): sendCommonDcs: end
W/.vedx.mentor10(32205): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (light greylist, reflection)
W/.vedx.mentor10(32205): constructJavaHashMap: start
W/.vedx.mentor10(32205): constructJavaHashMap: end
W/.vedx.mentor10(32205): sendCommonDcs: start
W/.vedx.mentor10(32205): sendCommonDcs: end
W/.vedx.mentor10(32205): Accessing hidden method Landroid/util/LongArray;->get(I)J (light greylist, reflection)
D/FlutterActivityAndFragmentDelegate(32205): Executing Dart entrypoint: main, and sending initial route: /
I/Choreographer(32205): Skipped 6 frames!  The application may be doing too much work on its main thread.
I/OpenGLRenderer(32205): Initialized EGL, version 1.4
D/OpenGLRenderer(32205): Swap behavior 2
E/Parcel  (32205): Reading a NULL string not supported here.
I/Choreographer(32205): Skipped 24 frames!  The application may be doing too much work on its main thread.
E/Parcel  (32205): Reading a NULL string not supported here.
D/FlutterView(32205): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@4bc4669
E/Parcel  (32205): Reading a NULL string not supported here.
Lost connection to device.
Exited (sigterm)

USB 没有物理损坏,并且在运行前确实显示了连接的设备。但是在运行visual studio代码和android studio后显示Lost connection。

颤振医生:

[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.778], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)

• No issues found!

我使用的是 Windows 10 和 Android 设备。我想在真实设备中测试和调试我的应用程序。有什么解决办法吗?

【问题讨论】:

这里可能会发生一些事情,但可以确定的是,您是否允许在手机上进行 USB 调试? 【参考方案1】:

尝试创建一个新的默认 Flutter 项目并将其调试到您的手机中。

【讨论】:

【参考方案2】:

您是否尝试从手机/模拟器手动卸载并运行 flutter clean , 也尝试一次禁用 chrome 中 dart devtools 的自动打开

【讨论】:

【参考方案3】:

您可以通过 USB 进行简单的调试..否则您可以通过 LAN 连接您的设备..

https://android.jlelse.eu/wireless-debugging-through-adb-in-android-using-wifi-965f7edd163a

【讨论】:

我不能简单地通过 USB 进行调试,因为它没有在连接的设备中显示我的设备。请再次阅读问题。另外,我不想使用 LAN,因为它与 USB 相比非常慢。

以上是关于颤振失去与新 USB 设备的连接的主要内容,如果未能解决你的问题,请参考以下文章

Flutter-未检测到连接的设备

苹果更新发布macOS Catalina 10.15.6,附原版系统镜像下载地址

颤振设备命令无法识别 android 设备

如何修复颤振医生不识别安卓手机

Flutter 不提示设备进行授权对话框

断开 USB 后,ADB over WiFi 连接丢失 [重复]