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

三世轮回 提交于 2019-12-10 13:58:20

问题


So this might be a bit of an edge case, but I'm using visual studio on a VM, and I have my phone in my hand. I'd like to set things up that when I press "play" in visual studio, it compiles my cordova app, and pushes it to my phone next to me, so I can test and debug etc.

My phone is 'rooted' and I have installed ADB wifi. I am able to connect to it from Visual Studio's adb version and also adb devices lists it.

 (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

When I press Play in Visual Studio it compiles and gets to the point where it needs to deploy to the phone and then it comes up with the following error: The system cannot find the file specified

(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:


I had a similar issue and this worked for me...


  1. adb kill-server

  2. adb tcpip 5555

  3. adb connect 10.10.10.6

  4. adb devices - should show your device

  5. Open Visual Studio as Admin

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

  7. Run your app



来源:https://stackoverflow.com/questions/43428085/how-to-convince-visual-studio-to-use-adb-for-android-dev-over-tcp-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!