mugetsu
mugetsu

Reputation: 4408

how to debug phonegap android application on the phone itself

I'm having some trouble getting debug mode to work on my android phone. I followed the instructions:

  1. turn on debug mode in phone
  2. set phone usb connection to pc mode
  3. install google usb driver
  4. connect android to pc, and then right click 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

Upvotes: 0

Views: 9014

Answers (2)

TryTryAgain
TryTryAgain

Reputation: 7830

To answer your title: how to debug phonegap android application on the phone itself

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.

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

But for debugging PhoneGap see below...

Taken from 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. 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. If you have both a device and a Android emulator running use -d and -e like so 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.

Upvotes: 3

prolink007
prolink007

Reputation: 34594

You need to make sure that you have usb-debugging enabled on your phone.

Settings -> Applications -> Development.

Here is link to a great source for this information.

Upvotes: 2

Related Questions