是否可以在不重新编译的情况下使 cordova 应用程序可调试?

Is it possible to make a cordova app debuggable without recompiling?

提问人:Jack O'Neill 提问时间:9/17/2021 更新时间:9/18/2021 访问量:254

问:

我有一个旧版本应用程序的 .apk 文件,但无法使用 cordova 从源代码重建应用程序。我正在尝试调试错误,并希望启用远程调试。是否可以在不重新构建应用程序的情况下启用 Web 视图的远程调试?

我尝试使用 apktool 解压缩应用程序,添加到 AndroidManifest.xml,然后重新打包并重新签署 .apk。android:debuggable="true"

当我运行该应用程序时,我可以在 chrome://inspect#devices 的设备列表中看到该设备,但 webview 没有出现。我错过了什么吗?

View of chrome inspect devices. The device is recognised but the webview is note://

安卓 科尔多瓦 远程调试 APKTOOL chrome-remote-debugging

评论

0赞 Morrison Chang 9/17/2021
请注意,在代码中已设置,developer.chrome.com/docs/devtools/remote-debugging/webviewsWebView.setWebContentsDebuggingEnabled(true);
0赞 Jack O'Neill 9/17/2021
谢谢你的@MorrisonChang!这似乎是问题所在。如果你想添加这个作为答案,我会接受的

答:

2赞 Morrison Chang 9/18/2021 #1

在 Android 上,为了在应用中调试 WebView,必须在应用代码中设置以下内容:

WebView.setWebContentsDebuggingEnabled(true);

寄件人: https://developer.chrome.com/docs/devtools/remote-debugging/webviews/

鉴于您正在对 APK 进行逆向工程,您可能需要查看代码是否存在并且需要特殊标志或尝试自己添加 Smali 代码