Website not opening in android studio

please, why is my free website not opening when i convert it to apk in android studio
but other domains that end with .com opens

I assume the other domains that your are trying are not hosted here, so I think it’s this:

4 Likes

It was showing smoothly before, is like their security’s has been changed

If it was working before, then can you explain any errors that you are getting, or what’s supposed to be happening but isn’t?

3 Likes

I will be happy if this can be fixed

You can

3 Likes

I’m not getting any error, the app is just showing blank

Do you have any solution to this?

Read

3 Likes

The security system would be the most likely explanation, but that system hasn’t seen any notable changes since InfinityFree started.

Does the page open when you open it in a browser? Or did you make any changes in the Android packaging that could explain the different behavior?

5 Likes

The page opens in my browser and also opens if I use appsgeyser.io to convert it to app, I actually don’t know what’s going wrong.

When I use http it will display
"Webpage not available
The webpage at http://mywebsite/ could not be loaded because:

net::ERR_CLEARTEXT_NOT_PERMITTED"
But when I use https it will display blank

Evidently you can only embed websites with HTTPS, which makes sense to have as a security requirement.

But your website seems to work with HTTPS. I can view it in my browser, you can view it in your browser, and you can view it through appsgeyser. As for why it doesn’t work with Android Studio, I don’t know. I know very little about mobile development, and I cannot see anything that would suggest that there is an issue with your website.

So to me everything points towards this either being some issue in your Android Studio installation or the app code you’re using to embed the site. And I cannot help you with that.

5 Likes

The best and simplest way is to debug your application (or source code)
and see what is written in the logcat logs from android studio.

maybe you need to have an intermediate CA… (just guessing).

5 Likes

Do you have any MainActivity.java that can convert web to apk?

package io.42webeen.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {

    private String url = "https://een.42web.io/";

    private WebView webView;

    @Override
    public void onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        webView = findViewById(R.id.web_view);
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setUseWideViewPort(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setAllowContentAccess(true);
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webSettings.setBlockNetworkImage(false);
        webSettings.setTextZoom(100);
        webSettings.setSupportZoom(true);
        webSettings.setBuiltInZoomControls(false);
        webSettings.setDisplayZoomControls(false);
        webSettings.setDefaultTextEncodingName("UTF-8");
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            webSettings.setAllowFileAccessFromFileURLs(true);
            webSettings.setAllowUniversalAccessFromFileURLs(true);
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
        }
        webSettings.setDomStorageEnabled(true);
        webSettings.setAppCacheEnabled(true);
        webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);

        webView.loadUrl(url);
    }
}
5 Likes

It’s very easy you can fix it by editing your AndroidManifest.xml and set the Clear text Traffic to true ( change the False to true )

Like the example

I had the same problem, but keep in mind this is temporarily fix

Example

android:usesCleartextTraffic=”true”

 <application
    android:name=”io.flutter.app.Test”
    android:label=”bell_ui”
    android:icon=”@mapmap/ic_launcher”
    android:usesCleartextTraffic=”true”>
4 Likes

Thanks so much, it actually worked

3 Likes

Happy to hear that !

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.