Android Chrome Debug

WebView Debug

Some application uses WebView to support Web contents.

In this time, we use WebView and load HTML file in remote.

But, sometimes contents have problem (javascript, css, etc…)

For PC browser, it’s easy to debug using Developer tool (IE, Chrome, Safari etc…)

Luckily, Android provides WebView debug using Chrome Debug

Requirements

  • Android 4.4 (Kitkat)
  • Debug version App
  • Need to add debug enable codes in your app

Codes

Please add following codes to your app

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
   if (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)){
      WebView.setWebContentsDebuggingEnabled(true);
   }
}

Check from Chrome

Open Chrome and type addressbar

chrome://inspect/#devices

Apple also provides test for UIWebView and WKWebView using Safari

コメント