简体   繁体   English

是否真的有一种方法可以在不使用电缆的情况下将 ADB 命令发送到非 root 的 android 设备?

[英]Is there truly a way to send ADB commands without the usage of a cable to a non-rooted android device?

So, let's make this perfectly clear.所以,让我们把它说清楚。

  • USB/Any other cable you can think of doesn't exist. USB/您能想到的任何其他电缆都不存在。 I don't want to EVER use one.我不想用不完之一。 Not in the process of establishing an environment where USB cables don't need to be used afterwards, not EVER .不是在建立一个以后不需要使用 USB 电缆的环境的过程中,而不是EVER Forget about cables, they don't exist.忘记电缆,它们不存在。
  • My android device is a physical mobile phone, no emulators.我的安卓设备是实体手机,没有模拟器。
  • It's not rooted and I don't care about methods involving rooting.没有生根,我不在乎涉及生根的方法。 I don't want to root my phone.我不想root我的手机。

Is there truly a way to establish the ADB and use it to send commands wirelessly on a non-rooted physical android device?真的有办法建立 ADB 并使用它在非 root 的物理安卓设备上无线发送命令吗? My scenario is basically one PC Desktop computer and one Android device.我的场景基本上是一台 PC 台式电脑和一台 Android 设备。 Nothing else.没有其他的。 I only need to establish ADB between the two under the mentioned conditions.我只需要在上述条件下在两者之间建立亚行。 If a method suiting my scenario and condition exists, what may it be?如果存在适合我的场景和条件的方法,那可能是什么?

There are countless of threads regarding this exact question, but many make the wrong answer and get good feedback, while others get moderated on and marked as duplicate of a thread that has absolutely nothing to do with the original question .关于这个确切的问题有无数个线程,但很多都给出了错误的答案并获得了良好的反馈,而其他线程则被审核并标记为与原始问题完全无关的线程的重复。 A typical answer to this type of thread or a moderator's reference either contain the usage of a cable and/or rooting the device, while the question has made it perfectly clear not to use any of it.此类主题的典型答案或版主的参考要么包含使用电缆和/或生根设备,而问题已明确说明不使用任何电缆。

It's misleading and annoying.这是误导和烦人的。 I can't get a simple answer out of anywhere involving this question.我无法从涉及这个问题的任何地方得到一个简单的答案。 It is confusing as it does not involve an answer that meets the original post's details, scenarios, etc.它令人困惑,因为它不涉及符合原始帖子详细信息、场景等的答案。

Yes.是的。 You can connect your Android device over WiFi to your PC, no cable required:您可以通过 WiFi 将您的 Android 设备连接到您的 PC,无需电缆:

(These steps are taken directly from the Android Developer Docs here: https://developer.android.com/studio/command-line/adb ) (这些步骤直接取自此处的 Android 开发人员文档: https : //developer.android.com/studio/command-line/adb

On Android 11+:在 Android 11+ 上:

  1. On your workstation, update to the latest version of the SDK Platform-Tools.在您的工作站上,更新到最新版本的 SDK Platform-Tools。
  2. On the device, enable developer options.在设备上,启用开发人员选项。
  3. Enable the Wireless debugging option.启用无线调试选项。
  4. On the dialog that asks Allow wireless debugging on this network?, click Allow.在询问是否允许在此网络上进行无线调试?的对话框中,单击允许。
  5. Select Pair device with pairing code.选择使用配对代码配对设备。 Take note of the pairing code, IP address, and port number displayed on the device.记下设备上显示的配对代码、IP 地址和端口号。

无线 ADB 配对对话框

  1. On your workstation, open a terminal and navigate to android_sdk/platform-tools.在您的工作站上,打开一个终端并导航到 android_sdk/platform-tools。
  2. Run adb pair ipaddr:port .运行adb pair ipaddr:port Use the IP address and port number from step 5.使用步骤 5 中的 IP 地址和端口号。
  3. When prompted, enter the pairing code that you received in step 5. A message indicates that your device has been successfully paired:出现提示时,输入您在步骤 5 中收到的配对代码。 一条消息表明您的设备已成功配对:
    none
    Enter pairing code: 482924
    Successfully paired to 192.168.1.130:37099 [guid=adb-235XY]
  1. (For Linux or Microsoft Windows only) Run adb connect ipaddr:port . (仅适用于 Linux 或 Microsoft Windows)运行adb connect ipaddr:port Use the IP address and port under Wireless debugging:使用无线调试下的IP地址和端口:

无线 adb IP 和端口号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM