android webview 远程调试
打开远程调试选项
MainActivity
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
quasar dev -m android --devtools --ide
d:
cd D:\work\web
quasar build -m android --devtools
d:
使用ege浏览器
Summary
- Turn on Android WebView debugging in your native Android app; debug Android WebViews in Microsoft Edge DevTools.
- To display the list of the Android WebViews with debugging turned on, go to
edge://inspect
. - Debug Android WebViews in the same way you debug a webpage through remote debugging.
Configure Android WebViews to debug
Android WebView debugging must be turned on within your app. To turn on Android WebView debugging, run the setWebContentsDebuggingEnabled static method on the WebView
class.
JavaCopy
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
The setting applies to all of the Android WebViews of the app.
Tip
Android WebView debugging isn't affected by the state of the debuggable
flag in the manifest of the app. If you want to turn on Android WebView debugging only when the debuggable
flag is true
, test the flag at runtime.
JavaCopy
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
{ WebView.setWebContentsDebuggingEnabled(true); }
}
Open an Android WebView in DevTools
To display a list of the Android WebViews with debugging turned on that run on your device, go to edge://inspect
.
To start debugging, under the Android WebView you want to debug, click inspect. Use DevTools in the same way that you use a remote browser tab.
原文地址:https://blog.csdn.net/zwhfyy/article/details/140198155
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!