Spi*_*rix 5 android usb-debugging flutter
adb通过 USB 和 WiFi 可以很好地连接到我的设备(小米红米 4、MIUI 11.0.2、Android 7.1.2)。但是,我尝试连接 flutter 没有成功。当我通过 USB 连接时,Flutter 确实会检测到我的设备,但不会提示授权对话框:
$ flutter doctor\n\nDoctor summary (to see all details, run flutter doctor -v): \n[\xe2\x9c\x93] Flutter (Channel beta, v1.14.6, on Linux, locale en_US.UTF-8) \n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 28.0.3)\n[\xe2\x9c\x93] Android Studio (version 3.6) \n[!] Connected device \n! Doctor found issues in 1 category.\n\n$ flutter devices \nNo devices detected. \n\nRun \'flutter emulators\' to list and start any available device emulators. \n\nOr, if you expected your device to be detected, please run "flutter doctor" to diagnose potential issues, or visit \nhttps://flutter.dev/setup/ for troubleshooting tips. \n\n\xe2\x80\xa2 Device 9fd66a407d14 is not authorized. \nYou might need to check your device for an authorization dialog. \nRun Code Online (Sandbox Code Playgroud)\n\n我试过了
\n\nadb kill-server以及adb start-server断开和重新连接我的设备但 flutter 仍然说我的设备未授权。
\n\n有解决办法吗?
\n我遇到了另一个问题adb,当我通过 USB 或 WiFi 连接到我的设备时,即使在我选中“始终允许来自这台计算机”之后,它也会提示我授权(这种情况已经一年多了,我从来没有真正知道过)为什么)
原来那是因为我已经~/.android/adbkey由root用户拥有了。因此,作为普通用户,adb将无法写入该文件,这意味着它将无法记住设备。我按照这个答案中的步骤解决了这个问题:
如本期所述,如果您
adb第一次以 root 身份运行,则可能会发生这种情况。它会在 root 用户拥有的计算机上创建一个密钥文件,因此您的普通用户帐户无法读取或覆盖它。要检查是否是这种情况:
Run Code Online (Sandbox Code Playgroud)$ ls -l ~/.android/adbkey -rw------- 1 root root 1708 Nov 13 2012 .android/adbkey ^ notice root here要解决这个问题:
Run Code Online (Sandbox Code Playgroud)$ sudo chown $USER: ~/.android/adbkey $ ls -l ~/.android/adbkey $ -rw------- 1 thomas thomas 1708 Nov 13 2012 /home/thomas/.android/adbkey ^ now shows your username and primary group最后,重新启动adb服务器:
Run Code Online (Sandbox Code Playgroud)$ adb kill-server $ adb start-server
一旦我解决了这个问题,Flutter 就完美运行了!
| 归档时间: |
|
| 查看次数: |
3874 次 |
| 最近记录: |