Android Emulator is not able to load URL

Swapnil Desale 0 Reputation points
2025-08-05T12:49:29.8033333+00:00

Hi Team,

I’m currently using the Android Emulator within Visual Studio 2022 and facing consistent issues accessing the application's APIs. The emulator is unable to reach the endpoints, and when I attempt to load the URLs through the mobile browser inside the emulator, I receive a "Connection is not private" message, and the pages fail to load entirely.

Interestingly, the same API links are working perfectly fine from the browser on same laptop, which rules out any connectivity issues on the host machine.

I've attached a screenshot for reference. Could you please advise.

image (1).png

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 79,101 Reputation points Volunteer Moderator
    2025-08-05T17:09:24.26+00:00

    Mobile api calls require https. The mobile o/s are more security conscious than laptops. Also on a mobile o/s, code can not override certificate validation. You must use a trusted certificate. If using self signed, it must be installed as trusted on the device.

    0 comments No comments

  2. Tony Dinh (WICLOUD CORPORATION) 725 Reputation points Microsoft External Staff
    2025-08-06T03:58:07.6233333+00:00

    Hi Swapnil Desale!

    This issue is common for many applications that try to access HTTPS which requires certificate validation.

    What is Certificate Validation?

    • Every HTTPS server presents an SSL/TLS certificate to prove its identity
    • The browser verifies this certificate is legitimate and trustworthy
    • This prevents attackers from impersonating websites (man-in-the-middle attacks)

    Here's how you can fix this issue:

    Install Your SSL Certificate in the Emulator

    1. Export the SSL certificate (usually .crt or .pem file) from your dev server.
      • For Android, the certificate must be in PEM or DER format
      • If you have a .p12 or .pfx file, convert it first
    2. Drag and drop the certificate file onto the running emulator window Alternatively, use adb push yourcert.crt /sdcard/Download/ to push it with adb
    3. Open Settings > Security > Encryption & credentials > Install from SD card (on the emulator) (Note: Path may vary by Android version - look for "Install certificates" or similar)
    4. Choose the certificate and install it as a "trusted credential".
      • Select "VPN and apps" or "CA certificate" when prompted
      • Note: User-installed certificates may not work with all apps
    5. Restart the emulator.
    6. Navigate back to Chrome and refresh the page (clear cache if needed).

    This will ensure Chrome in the emulator trusts the certificate.

    Chrome Development Option:

    • For local development only, you can navigate to chrome://flags/#allow-insecure-localhost
    • Enable "Allow invalid certificates for resources loaded from localhost"

    (Alternative but not recommended) If security is not a concern for your dev APIs, you can temporarily use HTTP (not HTTPS)

    Please note that: Android 9+ blocks HTTP by default. You must allow cleartext traffic in your app's network_security_config.xml. See here

    Documentation:

    I hope this helps!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.