如何调试Cordova混合应用程序 [英] How to debug a cordova Hybrid app

查看:73
本文介绍了如何调试Cordova混合应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我让我的cordova应用程序在远程设备上运行,并且我正在尝试测试扫描仪,因此必须在android设备本身上对其进行测试.

So, I got my cordova app running on my remote device and I am trying to test the scanner, so it has to be tested on an android device itself.

但是我不知道应该如何检查错误是否抛出,因为扫描仪无法在我的移动设备上工作.

But I do not know how I should check for the error its throwing because the scanner is not working in my mobile device.

任何帮助将不胜感激

谢谢

推荐答案

调试Android版Cordova应用程序需要遵循某些步骤.

There are certain steps which need to be followed to debug Cordova app for Android.

第1步:在系统中安装Android SDK工具,并确保命令在PATH中可用.

Step 1: Install Android SDK tools in your system and ensure the commands are available in PATH.

第2步:您需要在手机设置中启用开发人员选项"菜单.启用开发人员选项后,即可启用USB调试选项.

Step 2: You need to enable Developer options menu in your phone settings. Once Developer options get enabled, then you can enable USB debugging option.

第3步:搜索您的Android手机ADB驱动程序,如果使用Windows PC,则安装它们.通过USB连接后,这使ADB可以找到您的Android手机.可以在电话制造商的网站上轻松找到ADB驱动程序.

Step 3: Search for your Android phone ADB drivers and install them if using a Windows PC. This enables ADB to find your Android phone once connected via USB. One can easily find ADB drivers in phone manufacturer websites.

第4步:通过USB连接手机并确认显示的所有USB调试授权权限模式.

Step 4: Connect the phone via USB and confirm any USB debugging authorization permission modal displayed.

第5步:在手机中打开正在开发的应用.另外,在您的系统中打开Chrome浏览器,然后在选项卡中打开链接chrome://inspect/#devices.

Step 5: Open the app under development in your phone. Also open Chrome browser in your system and then the link chrome://inspect/#devices in a tab.

第6步:如果您的系统检测到手机,并且您的应用已在手机中打开,则上面打开的Chrome页面中将存在与您的应用相关的条目.打开链接以启动适用于您的应用的Chrome开发者工具.

Step 6: If your system has detected the phone and your app is open in the phone, then there will be an entry related to your app in the Chrome page opened above. Open the link to start Chrome Developer tools for your app.

在Chrome开发者工具中可以看到由Cordova JS代码引发的任何JS错误或打印的日志.

Any JS errors thrown or logs printed by the Cordova JS code can be seen in Chrome Developer tools.

如果Android设备检测本身存在问题,可能是由于以下原因:-

In case, there are issues in Android device detection itself, it can be due to below reasons:-

a)未安装ADB驱动程序.

a) ADB drivers not installed.

b)未安装ADB

c)USB电缆不起作用或松动.

c) USB Cable not working or loose.

d)手机中未启用开发人员选项和USB调试.

d) Developer Options and USB debugging not enabled in phone.

对所有内容进行排序后,就可以像在Chrome中浏览常规Web应用程序一样调试Cordova JS/HTML代码库.

Once everything is sorted, one can debug Cordova JS/HTML codebase like a regular web app in Chrome.

这篇关于如何调试Cordova混合应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆