-1

I tried all the methods on the web. but the screen coming first is with an error and then when we click on the link inside the error box, it traverses to the internet but does not open in the webview. i am using Android Studio. I am getting a screen on the webview that shows following lines.

"Webpage not availble

The webpage at http://www.google.com could not be loaded beacuse:

net::ERR_CACHE_MISS"

Please help soon.

here is my code:

MainActivity.java

package com.example.shabeer.webrtc;


import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;


   public class MainActivity extends AppCompatActivity {

   private WebView browser = (WebView) findViewById(R.id.web);
   @Override
   protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    WebSettings webSettings = browser.getSettings();
   webSettings.setJavaScriptEnabled(true);
    browser.loadUrl("http://beta.html5test.com/");

}

}

activity_main.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<WebView
    android:id="@+id/web"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</WebView>

Ambalika
  • 55
  • 1
  • 7

2 Answers2

0

kindly check whether you have added internet permission or not in Manifest.xml file

<uses-permission android:name="android.permission.INTERNET" />
0

I ran into the same issue because in my manifest folder I had the Internet permission capitalized:

<uses-permission android:name="android.permission.INTERNET"/>


but that doesn't sound like the case here

Click [https://stackoverflow.com/a/25860613/2530660]

Community
  • 1
  • 1
LEETAEJUN
  • 186
  • 9