Debugging Cordova App (android) with Visual Studio 2015 New Emulator

倖福魔咒の 提交于 2019-12-04 10:25:38

OK.. Ive posted this as an answer because it does deal with part of it.. and I did struggle a bit so it might help someone else. Running the emulator from VS2013. You need to go to the folder

C:\Program Files (x86)\Microsoft Visual Studio Emulator for Android\1.0

where the emulator is installed. Having run it at least once from VS2015, it had created a file called vsemu.vhd and vsemu.sdcard.vhd. Copy both these files to something similar in the same folder I used 'myemu'. Then to start the emulator I created a simple shortcut with the target property:

"C:\Program Files (x86)\Microsoft Visual Studio Emulator for Android\1.0\XDE.exe" /vhd bretts.vhd /video 1080x1920

this sets the resolution too.. You can find all the startup flags etc by using:

...XDE /?

Im not sure yet, but I think it stored the various app shortcuts in the sdcard file.. although I wouldn't swear to it. Ill repost if something changes there.

Ok Debugging.. I started VS2013 and set the debug target as 'Device'. This worked fine.. so far.

Id still love to know why 2015 is not deploying properly though, for now I'll just assume its the 'bleeding' part of the bleeding edge. Cheers

There is a known issue in Visual Studio 2015 CTP5 with Cordova projects deploying to the Visual Studio Emulator for Android. The issue will be resolved in the next release.

In the meantime, here are a few workarounds to try:

  1. Search your machine for Microsoft.VisualStudio.MultiDeviceHybridApps.dll. There will be two copies--one under "Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Emulator for Android\" (the VS Emulator version of the dll) and one in another folder under "Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\" (the folder name varies, but it is always some random hash; this is the Cordova version of the dll). Close out of VS2015 and replace the Microsoft.VisualStudio.MultiDeviceHybridApps.dll in the Emulator for Android folder with the one in the Cordova folder (delete the Emulator one, copy the Cordova one, and paste it in the Emulator folder). Then go to "C:\Users\your username\AppData\Local\Microsoft\VisualStudio\14.0\Extensions" and delete the contents of this folder.

  2. Create a new Visual C++ Native-Activity Application (File > New > Project, under Installed\Templates\Visual C++\Cross Platform\Native-Activity Application (Android)) and run it, then return to your Cordova project.

  3. Reinstall CTP5 and the Visual Studio Emulator for Android and reinstall.

Hope this helps!

Another workaround for webkit developers (Android and iOS), the Chrome remote debugger, check out here.

With this you can debug as you would do normally, this does work with the emulators of vs2015 ctp5!

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