gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 19:16:12 25 4
gpt4 key购买 nike

adb通过 USB 和 WiFi 连接到我的设备(小米红米 4、MIUI 11.0.2、Android 7.1.2)就好了。但是,我尝试连接 flutter 没有成功。当我通过 USB 连接时,Flutter 会检测到我的设备,但不会提示输入授权对话框:

$ flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.14.6, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.6)
[!] Connected device
! Doctor found issues in 1 category.

$ flutter devices
No devices detected.

Run 'flutter emulators' to list and start any available device emulators.

Or, if you expected your device to be detected, please run "flutter doctor" to diagnose potential issues, or visit
https://flutter.dev/setup/ for troubleshooting tips.

• Device 9fd66a407d14 is not authorized.
You might need to check your device for an authorization dialog.

我试过了
  • adb kill-serveradb start-server以及断开和重新连接我的设备
  • 从我的手机撤销 USB 调试授权
  • 从我的手机禁用和重新启用 USB 调试
  • 重启手机

  • 但 flutter 仍然说我的设备未经授权。

    有解决方案吗?

    最佳答案

    我遇到了 adb 的另一个问题其中,当我通过 USB 或 WiFi 连接到我的设备时,即使在我选中“始终允许从这台计算机”后,它也会提示我授权(这种情况已经持续了一年多,我真的不知道为什么)

    原来那是因为我有 ~/.android/adbkey由 root 用户拥有。所以作为普通用户,adb将无法写入该文件,这意味着它将无法记住设备。我通过步骤 in this answer 解决了这个问题:

    As described in this issue, this can happen if you run adb for the first time as root. It creates a key file on your computer owned by the root user, so your normal user account can't read or overwrite it.

    To check if this is the case:

    $ ls -l ~/.android/adbkey
    -rw------- 1 root root 1708 Nov 13 2012 .android/adbkey
    ^ notice root here

    To fix it:

    $ 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

    Finally, restart the adb server:

    $ adb kill-server
    $ adb start-server


    一旦我解决了这个问题,Flutter 就完美地工作了!

    关于android - Flutter 不提示设备进行授权对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60507176/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com