question

J. mcnalley avatar image
J. mcnalley asked

How to enable AmazonWebView remote debugging?

I'm building a hybrid app that uses the AmazonWebView replacement for the standard Android WebView, and testing on a 7" Kindle Fire HDX. So far everything is great - performance and functionality are both clearly better than with the old Android WebView. However, I have a few minor issues that are probably due to my HTML5 code. According to the HTML5 Hybrid Apps FAQ and "Understanding" page, the AmazonWebView provides "Support for Web Developer Tools for on-device debugging and profiling". I can't find any documentation that explains [i]how[/i] to enable remote debugging. I am able to enable remote debugging within the Web Tester App, but that doesn't help me debug my own apps. If I was using the standard WebView on SDK version 19, I could just call WebView.setWebContentsDebuggingEnabled(true), but that method doesn't exit on the v17 WebView, and wasn't added to the AmazonWebView. So: What do I need to do to enable remote debugging of web content within an AmazonWebView? Thanks, -James
web apps
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
One of the following APIs will need to be used to enable Dev Tools: 1. AmazonWebKitFactory#enableDeveloperToolsUnix(String socketName), by convention we are using appname+'.devtools' for the socket name, e.g. 'com.amazon.mp3.devtools', here's an example (this refers to the app activity, e.g. code for the onCreate method): AmazonWebKitFactory factory = AmazonWebKitFactories.getDefaultFactory(); if (factory.getWebKitCapabilities().isDeveloperToolsSupported()) { factory.enableDeveloperToolsUnix(this.getPackageName() + ".devtools"); } Setup port forwarding over adb: adb forward tcp:9222 localabstract: 2. AmazonWebKitFactory#enableDeveloperToolsTcp(int portNumber) AmazonWebKitFactory factory = AmazonWebKitFactories.getDefaultFactory(); if (factory.getWebKitCapabilities().isDeveloperToolsSupported()) { factory.enableDeveloperToolsTcp(1234); } You can port forward over adb with numbered ports as well, e.g.: adb forward tcp:1234 tcp:1234 Make sure your computer is on the same wifi network as your device, then connect to the correct port in your browser: http://: You can get the device ip with adb shell ifconfig [wlan0] (wlan0 is optional, and should not really be in brackets, but that is the interface used on our devices) NOTE: Both APIs must be called AFTER AmazonWebkitFactory.initialize() and this works in the latest version of AWV under latest Fire OS. We are sorry for missing this out on documentation. We will add it shortly there. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

J. mcnalley avatar image
J. mcnalley answered
Thanks, I'm now able to debug my app remotely from Chrome! Note: I should have marked your reply as "correct" rather than "helpful", can a moderator fix this? -James added moderation request. Message was edited by: J. mcnalley
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.