While attempting to open an HTML file with JavaScript in an Android Webview, I encountered an error after implementing the onConsoleMessage of my WebChromeClient:
Uncaught ReferenceError: console is not defined -- From line 10 of file:///storage/sdcard0/TargetApp/e184bae3-5824-4e23-a26e-820ce6d32aa2/pres/fce4da510de8431bB3eeD5bdbd1c695d/fce4da510de8431bB3eeD5bdbd1c695d/html/js/target/util_Q_3bb82a6eabd3339d91ca15cb4fd6685c.js
Here is line 10 of my file:
console = console ? console : { log : function() {}, debug : function() {}};
Curiously, this code works fine on browsers and iOS webview.
If anyone has any insights into what might be causing this issue, please share them.