Search code examples
javascriptandroidionic-frameworkcapacitor

Android : getBridge() is returning null after capacitor 3.3.3 upgrade


So based on documentation https://capacitorjs.com/docs/updating/3-0

Updated capacitor to latest version 3.3.3 and removed deprecated init() method from mainAcivity.kt file but getBridge() is returning null and not able to get webview.

getBridge().webView.addJavascriptInterface(JSInterface(this@MainActivity), "androidCallback")

I would appreciate any help how to get this getBridge() working so that it starts communicating with JS methods.


Solution

  • Apparently, this issue was solved here https://github.com/ionic-team/capacitor/pull/5328/commits and will probably be included in the next capacitor release.