title: Android WebView Uncaught TypeError: Object [object Object] has no method
body: <p>I have two devices, Samsung Tablet GT-P3113 and Mini-PC rk31 sdk (both android 4.2.2), running my app. My app use a javascript interface to access a java method. In one of the two devices works fine(samsung), but the other don't. </p>
  
  <h2>BrowsableView - my class extends webview</h2>
  
  <pre><code>
   public class BrowsableView extends WebView {
  
       @SuppressLint("SetJavaScriptEnabled")
       public BrowsableView(Context context, AttributeSet attrs) {
  
          super(context, attrs);
  
          /// configurações para permitir execução de javascript
          WebSettings webSettings =  getSettings();              
          webSettings.setPluginState(PluginState.ON);
          webSettings.setJavaScriptEnabled(true);            
  
          setClickable(true);
  
          setKeepScreenOn(true);
  
          setBackgroundColor(Color.TRANSPARENT);    
  
          setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);        
  
          addJavascriptInterface(new WebAppInterface(Config.getContext()), "Android");
  
          setWebViewClient(new BrowsableViewClient());
  
          setWebChromeClient(new BrowsableViewChromeClient());
      }
  
      public void prepareNextHtml(String url){
          loadUrl(url);        
      }
  
      public class BrowsableViewClient extends WebViewClient{
  
          @Override
          public void onReceivedError(WebView view, int errorCode,String description, String failingUrl) {
  
              Log.d(TAG, "EVENTO ONERROR DENTRO DO BROWSABLE");                        
              _dispatchBrowsableViewErrorEvent();
          }
      }
  
      public class BrowsableViewChromeClient extends WebChromeClient{
  
          @Override
          public boolean onConsoleMessage(ConsoleMessage cm){
              Log.d("WebView", String.format("%s @ %d: %s", cm.message(), cm.lineNumber(), cm.sourceId()));
              Toast.makeText(getContext(), "WebViewConsole: " +  String.format("%s @ %d: %s", cm.message(), cm.lineNumber(), cm.sourceId()), Toast.LENGTH_LONG).show();
              return true;
          }
      }
  
      public class WebAppInterface {
  
          Context mContext;
  
          public WebAppInterface(Context c){
              mContext = c;   
          }            
  
          @JavascriptInterface
          public void finish(){              
              handler.removeCallbacksAndMessages(null);
  
              Toast.makeText(getContext(), "Evento onCompletion no BrowsableView  - Android.finish().", Toast.LENGTH_LONG).show();                      
              _dispatchBrowsableViewCompletionEvent();
          }
      }
  }
  </code></pre>
  
  <h2>Html Sample</h2>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
      setTimeout("Android.finish()",8000);    
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body width="100%" height="100%"&gt;
      &lt;img width="100%" height="100%" src="654138997615629/teste.jpg" /&gt;    
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In Mini-Pc device does not recognize the method the javascript interface and returns error like that</p>
  
  <blockquote>
    <p>Uncaught TypeError: Object [object Object] has no method "finish"</p>
  </blockquote>