Reputation: 53
I have some weird error loading URL using WebView.
D/chromium﹕ Unknown chromium error: -400
My code initializing webview (in Activity.onCreate()):
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.google.pl");
Manifest permission:
<uses-permission android:name="ANDROID.PERMISSION.INTERNET"/>
Problem on Lolipop and Kitkat. Build tools 22.0.1. I believe problem is trivial, but I can't make it work. Have any idea?
Upvotes: 0
Views: 1778
Reputation: 53
Problem was trivial:
<uses-permission android:name="ANDROID.PERMISSION.INTERNET"/>
is not correct, it should be:
<uses-permission android:name="android.permission.INTERNET" />
Funny part is that AndroidStudio automatically gives you invalid permission on ctrl+space....
Upvotes: 0
Reputation: 18765
Add this overriding method to your WebViewClient implementation. You'll need to compile it with Android SDK 2.2 (API level 8) or later. The method appears in the public SDK as of 2.2 (API level 8) but we've tested it on devices running 2.1, 1.6 and 1.5 and it works on those devices too (so obviously the behaviour has been there all along).
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed(); // Ignore SSL certificate errors
}
Hope this will help you.
Upvotes: 1