console.log and HTC devices

Showing 1-7 of 7 messages
console.log and HTC devices Paul Beusterien 4/29/11 9:40 AM
Does anyone know the right trick to show console.log output in adb logcat for HTC devices from PhoneGap apps? I have no problem with the emulator, Nexus One or Motorola Droid. See also the unanswered http://stackoverflow.com/questions/5538516/javascript-console-log-on-htc-android-devices-and-adb-logcat
Re: [PhoneGap] console.log and HTC devices Michael Herger 4/29/11 1:33 PM

This report is about running console.log() in the browser. I've never had problems using it in PhoneGap.

--

Michael

Re: [PhoneGap] console.log and HTC devices Paul Beusterien 4/29/11 2:09 PM
I haven't had a problem using console.log in PhoneGap either on other devices, but it doesn't work for me on the HTC Evo.

Paul
Re: console.log and HTC devices zb 4/29/11 3:16 PM
Hello,

In eclipse click Window -> Show View -> other..

in the pop up window. Expand Android folder select LogCat and press
ok.

Logcat tab should show up in the bottom window frame.

-zb

On Apr 29, 12:40 pm, paulb <paul.beuster...@gmail.com> wrote:
> Does anyone know the right trick to show console.log output in adb logcat
> for HTC devices from PhoneGap apps? I have no problem with the emulator,
> Nexus One or Motorola Droid. See also the unansweredhttp://stackoverflow.com/questions/5538516/javascript-console-log-on-...
Re: console.log and HTC devices Patrick Mueller 4/30/11 6:22 AM
On 4/29/11 5:09 PM, paulb wrote:
> I haven't had a problem using console.log in PhoneGap either on other
> devices, but it doesn't work for me on the HTC Evo.

If you happen to be using weinre, it intercepts console.log() requests,
so you won't see them in the usual place.  It should only be doing this
while the debugger client is connected to a target, so you be able see
console output somewhere.

BTW, I'm planning on fixing my console.log() support to pass through the
messages to the original console, instead of overriding them.

--
Patrick Mueller - http://muellerware.org

Re: console.log and HTC devices Paul Beusterien 4/30/11 1:17 PM
I did some more investigation today in the Java debugger. 

On the Nexus One, the following method in DroidGap gets called on a JavaScript console.log :

     // console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html

    @Override

    public void onConsoleMessage(String message, int lineNumber, String sourceID)

    {       

    // This is a kludgy hack!!!!

    Log.d(TAG, sourceID + ": Line " + Integer.toString(lineNumber) + " : " + message);

    }


On the HTC Evo, the breakpoint in onConsoleMessage never gets hit. 


Also, I found further evidence on stackoverflow that there is a general problem with console.log, Android 2.2 and HTC devices.


For now, I'll stick to the Nexus One or Droid when I need console.log. 

Re: console.log and HTC devices Paul Beusterien 4/30/11 2:06 PM
Patrick,

I wasn't running weinre, but am now and it's a good workaround for the HTC Evo problem. All of the console.log messages come to the weinre console.

BTW, weinre is a great tool! It is cool to inspect and control my device from my laptop.

Any hope of adding JavaScript run control?

Cheers,
Paul