如何远程调试Webview? [英] How to debug webview remotely?

查看:138
本文介绍了如何远程调试Webview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何调试/检查apk webview的元素.
我已经尝试过,但这仅对chrome有用apk.

How can I do debug/inspect element of apk webview.
I have tried this but it is helpful only for chrome not for apk.

请建议我

推荐答案

尝试一下:

  1. 在设备中启用开发人员选项(设置->关于电话->在内部版本号上点击7次)
  2. 打开开发人员选项并启用USB调试(在开发人员选项中)
  3. 将此行添加到您自定义的Application类或加载Web视图的Activity中

  1. Enable Developer Options in Device (Settings-->About Phone-->Tap 7 times on build number)
  2. Turn on Developer options and Enable USB Debugging (in Developer Options)
  3. Add this line in your custom Application class or in the Activity where the Web View is loaded

//如果您的构建处于调试模式,请启用检查Web视图

// if your build is in debug mode, enable inspecting of web views

if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
    WebView.setWebContentsDebuggingEnabled(true);
}

  • 打开Chrome并输入chrome://inspect/#devices,您应该会在远程目标列表"中看到您的设备

  • Open Chrome and type chrome://inspect/#devices and you should see your device in the Remote Target List

    快乐的编码.

    这篇关于如何远程调试Webview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆