简体   繁体   English

在 android 仿真器中运行 html5

[英]running html5 in an android emulator

I've just started developing an html5 game using VS Code.我刚刚开始使用 VS Code 开发 html5 游戏。 I see it being mainly used from pcs/laptops and have managed to set up the Chrome debugger so I can debug the webpage in chrome.我看到它主要用于个人电脑/笔记本电脑,并设法设置了 Chrome 调试器,以便我可以在 chrome 中调试网页。

However I'd like to be able to debug it using an android emulator too, to check the screens look right, etc. I have Android Studio installed, and an emulator that works, but I can't find any VS Code debugger extensions that will launch the webpage in the browser of the emulator.但是,我也希望能够使用 android 仿真器对其进行调试,以检查屏幕是否正确等。我安装了 Android Studio 和一个可以工作的仿真器,但我找不到任何 VS Code 调试器扩展将在模拟器的浏览器中启动网页。

Is there any way to do it?有什么办法吗?

This method is tested both on emulator and actual physical device.此方法在模拟器和实际物理设备上都进行了测试。

Goto Chrome.转到铬。 Then goto chrome://inspect/#devices .然后转到chrome://inspect/#devices

Physical Device:物理设备:

Then you can connect your phone to pc and turn on USB Debugging on your phone.然后你可以将你的手机连接到电脑并在你的手机上打开USB Debugging Accept the debugging message on your phone.接受手机上的调试消息。 Then you get access to all chromium based apps like Chrome, Brave or other Hybrid apps developed using Cordova etc.然后,您可以访问所有基于铬的应用程序,例如 Chrome、Brave 或其他使用 Cordova 等开发的混合应用程序。

Emulator:模拟器:

Close all emulators running.关闭所有正在运行的模拟器。 Start Android Studio.启动 Android Studio。 Start the emulator.启动模拟器。 Goto Android Studio logcat and check if emulated is alive.转到 Android Studio logcat 并检查仿真是否存在。 Then goto chrome://inspect/#devices .然后转到chrome://inspect/#devices

If emulator ADB authentication fails in chrome.如果模拟器 ADB 身份验证在 chrome 中失败。 Goto AVD manager and wipe data of virtual device.(Only Emulator)转到 AVD 管理器并擦除虚拟设备的数据。(仅限模拟器)

检查设备

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

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