# Uncaught TypeError: Android.showToast is not a function

**Code:** `WebView: JavaScript interface method is undefined` · **Category:** Android · **Seen on:** Android, Kotlin

The `addJavascriptInterface` object isn't reachable or the method lacks `@JavascriptInterface`.

## 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

1. Annotate the method
2. `settings.javaScriptEnabled = true`
3. Add the interface before loading

## Detailed fix by platform

### Kotlin

1. 

```kotlin
webView.settings.javaScriptEnabled = true
webView.addJavascriptInterface(Bridge(), "Android")
```


## How to diagnose

1. **Annotation** — present?
2. **JS** — enabled?
3. **Order** — before load?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/android/webview-javascript-interface-undefined)
