简体   繁体   English

如何在手机本身上调试phonegap android应用程序

[英]how to debug phonegap android application on the phone itself

I'm having some trouble getting debug mode to work on my android phone. 我在让调试模式在我的Android手机上工作时遇到了一些麻烦。 I followed the instructions: 我按照指示进行:

  1. turn on debug mode in phone 在手机中打开调试模式
  2. set phone usb connection to pc mode 将手机USB连接设置为PC模式
  3. install google usb driver 安装Google USB驱动程序
  4. connect android to pc, and then right click project->run as->android app 将android连接到pc,然后右键单击project-> run as-> android app

this results in my emulator popping up and nothing happening on my phone. 这导致我的模拟器弹出,而我的手机上没有任何反应。 What could I be missing here? 我在这里可能想念什么?

thanks 谢谢

EDIT: got it working guys, I installed the OEM driver instead 编辑:让它工作的人,我安装了OEM驱动程序

To answer your title: how to debug phonegap android application on the phone itself 回答您的标题: 如何在手机本身上调试phonegap android应用程序

You can use a variety of apps that can capture the log for you. 您可以使用各种可以为您捕获日志的应用程序。 Which are absolutely helpful in debugging. 这对调试绝对有帮助。 And it gives you relatively (choose your filters or log mode; verbose, debug etc) the same information, although not same feel, as the debugging PhoneGap section below. 并且它为您提供了与以下调试PhoneGap部分相对(尽管选择不相同)的相对信息(选择过滤器或日志模式;详细信息,调试等)。

https://market.android.com/search?q=logcat https://market.android.com/search?q=logcat

But for debugging PhoneGap see below... 但是要调试PhoneGap,请参见下文...

Taken from http://wiki.phonegap.com/w/page/16494774/Getting%20started%20with%20Android%20PhoneGap%20in%20Eclipse 取自http://wiki.phonegap.com/w/page/16494774/Getting%20started%20with%20Android%20PhoneGap%20in%20Eclipse

SOLUTION: To get more information about what is going one while phonegap is running, run the Android log viewer. 解决方案:要获取有关phonegap运行时正在运行的内容的更多信息,请运行Android日志查看器。 adb logcat if adb isn't found you just need to do the full path to it something like ~/projects/andriod/android-sdk-mac_86/tools/adb logcat . 如果未找到adb logcat需要执行完整路径即可,例如~/projects/andriod/android-sdk-mac_86/tools/adb logcat If you have both a device and a Android emulator running use -d and -e like so adb -e logcat . 如果您同时运行设备和Android模拟器,请使用-d和-e,例如adb -e logcat This should give you more info about what is going on. 这应该为您提供有关正在发生的事情的更多信息。 Here is a small example clipping form the android logs. 这是裁剪日志的一个小例子。

D/PhoneGapLog(  291): file:///android_asset/www/phonegap.js: Line 216 : TypeError: Result of expression 'accel' [undefined] is not an object.
E/Web Console(  291): TypeError: Result of expression 'accel' [undefined] is not an object. at file:///android_asset/www/phonegap.js:216
D/dalvikvm(  117): GC_EXPLICIT freed 1727 objects / 91840 bytes in 110ms
D/PhoneGap(  291): The provider network is disabled
D/SntpClient(   61): request time failed: java.net.SocketException: Address family not supported by protocol

From this we can see that the accel is not working. 由此可见加速不起作用。 And some information about the location of the Error. 以及有关错误位置的一些信息。 This helps debug problems and also helps you to give more information when asking the PhoneGap community for help. 这有助于调试问题,还可以帮助您在向PhoneGap社区寻求帮助时提供更多信息。

You need to make sure that you have usb-debugging enabled on your phone. 您需要确保在手机上启用了USB调试功能。

Settings -> Applications -> Development. 设置->应用程序->开发。

Here is link to a great source for this information. 这是此信息的绝佳来源的链接。

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

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