Uncaught TypeError: Android.showToast is not a function
The addJavascriptInterface object isn't reachable or the method lacks @JavascriptInterface.
Uncaught TypeError Android.showToast is not a functionJavascriptInterface not workingaddJavascriptInterface undefinedUncaught TypeError: Android.showToast is not a function (WebView console, line 1) Meaning
From API 17 methods must be annotated @JavascriptInterface. Also JavaScript must be enabled, the name must match, and the interface must be added before loading the URL.
Common causes
- Missing @JavascriptInterface
- JavaScript disabled
- Interface added after loadUrl
⚡ Quick fix
- Annotate the method
settings.javaScriptEnabled = true- Add the interface before loading
Detailed fix by platform
Kotlin
- kotlin
webView.settings.javaScriptEnabled = true webView.addJavascriptInterface(Bridge(), "Android")
How to diagnose
- Annotation — present?
- JS — enabled?
- Order — before load?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AccessibilityService restricted setting (Android 13) Restricted setting: For your security, this setting is currently unavailable
- Android resource linking failed AAPT: error: resource x (aka y) not found — Android resource linking failed
- android:attr/lStar not found AAPT: error: resource android:attr/lStar not found
Most viewed in Android
- Could not resolve Gradle: Could not resolve all files for configuration / Could not resolve dependency
- INSTALL_FAILED_USER_RESTRICTED INSTALL_FAILED_USER_RESTRICTED: Install canceled by user (Xiaomi/MIUI, Oppo, Vivo)
- INSTALL_PARSE_FAILED_NO_CERTIFICATES INSTALL_PARSE_FAILED_NO_CERTIFICATES / App not installed as package appears to be invalid
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Nov 2026