androidcordovaremote-debuggingapktoolchrome-remote-debugging

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


I have an .apk file for an old version of an app but don't have the ability to rebuild the app from source using cordova. I'm trying to debug an error and would like to enable remote debugging. Is it possible to enable remote debugging of the webview without rebuilding the app?

I've tried unpacking the app using apktool, adding android:debuggable="true" to the AndroidManifest.xml and then repacking and resigning the .apk.

When I run the app I can see the device in the device list of chrome://inspect#devices but the webview is not appearing. Am I missing something?

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


Solution

  • On Android in order to debug a WebView inside of an app, the following must be set in the app's code:

    WebView.setWebContentsDebuggingEnabled(true);

    From: https://developer.chrome.com/docs/devtools/remote-debugging/webviews/

    Given that you are reverse engineering an APK, you may want to look to see if the code exists and needs a special flag or attempt to add in the Smali code yourself.