Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERR_ACCESS_DENIED in webView in android

Tags:

android

i have created a webview app for android studio. but didn't load the web url. the error is net::ERR_ACCESS_DENIED. can anyone help with this

like image 391
Anuradha Avatar asked Jul 21 '19 08:07

Anuradha


3 Answers

For me the problem was a bit silly, I had originally forgot to add android:usesCleartextTraffic="true" in the manifest and launched the app. After I added android:usesCleartextTraffic="true" it still gave ERR_ACCESS_DENIED. I then cleared the data, un-installed the app, re-installed it and bam, the error is gone.

like image 182
lelloman Avatar answered Nov 15 '22 17:11

lelloman


Just started to develop android apps and got the same error even when I had permission:

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

Then I've uninstalled the app inside emulator and build again and now the app can access internet.

like image 22
HasanG Avatar answered Nov 15 '22 16:11

HasanG


Try add these to your webview code:

webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setAllowFileAccess(true);

If it still doesn't work, try add android:usesCleartextTraffic="true" to your application tag in your manifest.

like image 18
mindrex Avatar answered Nov 15 '22 15:11

mindrex