Created
March 19, 2022 17:14
-
-
Save cruzer45/82fa940f926031e9d8fea91281013f54 to your computer and use it in GitHub Desktop.
Enable remote debugging in Cordova Production webview.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In {project}/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.java | |
//Determine whether we're in debug or release mode, and turn on Debugging! | |
ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo(); | |
if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 && | |
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { | |
enableRemoteDebugging(); | |
} | |
// .... | |
@TargetApi(Build.VERSION_CODES.KITKAT) | |
private void enableRemoteDebugging() { | |
try { | |
WebView.setWebContentsDebuggingEnabled(true); | |
} catch (IllegalArgumentException e) { | |
LOG.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! "); | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment