How to debug silk browser on Kindle Fire?

I experience several different javascript actions when launching my site in Kindle Fire than through Chrome. To debug this, I need access to something like a Chrome or Firebug developer tool. Any suggestions?

+5
source share
2 answers

In the same boat here ... was hoping adb logcat would help, but the javascript console messages didn't seem to appear there. Perhaps there is something that needs to be configured on the device for direct logging of logs for the logarithm?

edit: found a decent solution: http://jsconsole.com - allows you to configure a remote debugging / registration console. Pretty simple (console-only logging, so you'll need to dump a lot of logs) ... but it works well. Helped me track down the source of my problems, at least!

how-to: http://jsconsole.com/remote-debugging.html

+5
source

I took a different approach and created my own wrapper application in which a dialog box for JavaScript appears.

My wrapper code is quite large, so I took a snippet from other parts. It actually works and will display ANY javascript error.

// registers the debugger to catch errors 
WebView engine = (WebView) findViewById(R.id.web_engine);
engine.setWebChromeClient(new DebugClient(this));

// the class that manages the errors
private class DebugClient extends WebChromeClient {
        Activity activity;

        public DebugClient(Activity activity) {
            this.activity = activity;
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            if (consoleMessage.messageLevel() == MessageLevel.ERROR
                    || consoleMessage.messageLevel() == MessageLevel.WARNING) {
                String title="Javascript error on line "
                        + String.valueOf(consoleMessage.lineNumber())
                        + " of " + consoleMessage.sourceId();
                AlertBox alertBox=new AlertBox(activity, (ActionListener)null, title, consoleMessage.message(), "OK");
                alertBox.show();
                alertBoxes.add(alertBox);
            }
            return true;
        }
    }

, Android SDK , , Java IDE (Eclipse?) ADT. : , WebView /main.xml . Kindle Fire.

0

All Articles