如何说服 Visual Studio 在 TCP/IP 上使用 ADB 进行 android 开发

How to convince Visual Studio to use ADB for android dev over TCP/IP

所以这可能有点极端,但我在 VM 上使用 visual studio,而且我手上有 phone。我想设置一下,当我在 visual studio 中按 "play" 时,它会编译我的 cordova 应用程序,并将它推送到我旁边的 phone,这样我就可以测试和调试等等

我的phone是'rooted'并且我已经安装了ADB wifi。我可以从 Visual Studio 的 adb 版本连接到它,并且 adb devices 也列出了它。

 (output from cmd.exe running as Admin in the solution folder)

 C:\Stuff\Code\svn\myapp\MyApp>adb connect 10.10.10.6
 already connected to 10.10.10.6:5555

 C:\Stuff\Code\svn\myapp\MyApp>adb devices
 List of devices attached
 10.10.10.6:5555 device

当我在 Visual Studio 中按下播放时,它会编译并到达需要部署到 phone 的位置,然后出现以下错误:The系统找不到指定的文件

(output from "output" tab in visual studio)

C:/Stuff/Code/svn/myapp/myApp/platforms/android/build/outputs    /apk/android-debug.apk
No scripts found for hook "after_build".
No scripts found for hook "after_compile".
------ Copying back to project: android
2>------ Deploy started: Project: MyApp, Configuration: Debug Android     ------
2>  Querying ADB for attached devices...
2>The system cannot find the file specified
2>The system cannot find the file specified
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

我遇到了类似的问题,这对我有用...


  1. adb kill-server

  2. adb tcpip 5555

  3. adb connect 10.10.10.6

  4. adb devices - 应显示您的设备

  5. Open Visual Studio as Admin

  6. Type: ALT+B, R (ALT+B then R) to rebuild your solution

  7. Run your app