Home » Android » android – WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS

android – WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS

Posted by: admin March 11, 2020 Leave a comment


I’m starting to work on an app on Android, so I don’t have much. All I have is just a WebView so far. I created the project in Android Studio, and my project got set as an Android InstantApp. I’m not sure why/how, but my guess is that I overlooked an option for it when creating the project.

I was getting an error from the WebView saying net::ERR_CLEARTEXT_NOT_PERMITTED. When I googled the error, I saw that when an app is an InstantApp, WebViews can only load sites that are HTTPS, and cannot load an HTTP site.

The purpose of this app is to be an extremely simple Flash player for only one site. This is to have better performance running a game that requires Flash. This game is at darkorbit.com, which is HTTPS.


package com.tylerr147.darkorbit;

import android.content.ComponentName;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

        WebView wv = findViewById(R.id.webView1);
        wv.setWebViewClient(new CustomWebViewClient());
        WebSettings webSettings = wv.getSettings();


and CustomWebViewClient.java

package com.tylerr147.darkorbit;

import android.webkit.WebView;
import android.webkit.WebViewClient;

public class CustomWebViewClient extends WebViewClient {
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return true;

My question:
How can I disable my app as an InstantApp, or how can I get this WebView to display the site?

I feel like it’s important I mention a few other details too:
In the app, where it is showing the WebView, it also says “The webpage at http://darkorbit.com/” could not be loaded because:

Notice that is says “… site at http://darkorbit.com/ …”, and not “… site at https://darkorbit.com/ …” even though the string for the URL is hardcoded, and says “https://darkorbit.com/“. Also, I am testing the app on an emulator set up as a Google Pixel 2 running Android 9.

Any help would be appreciated. Thank you.

How to&Answers:


Add the below line in your application tag:


As shown below:


Hope it helps.


When you call “https://darkorbit.com/” your server figures that it’s missing “www” so it redirects the call to “http://www.darkorbit.com/” and then to “https://www.darkorbit.com/“, your WebView call is blocked at the first redirection as it’s a “http” call.
You can call “https://www.darkorbit.com/” instead and it will solve the issue.