'OMSDroid - Doesn't load the map. Error: java.io.IOException: Unable to find default handler for protocol: https

I have a problem with the OSMDroid libraries. In my application I have a Fragment which should contain a map (OpenStreetMap) and and when I load the page, the map is not displayed. I went to debug on the library and I discovered that the instruction that goes in error is the following:

if (Configuration.getInstance().getHttpProxy() != null) {
     c = (HttpURLConnection) new URL(tileURLString).openConnection(Configuration.getInstance().getHttpProxy());
} else {
    c = (HttpURLConnection) new URL(tileURLString).openConnection();
}

File: TileDownloard.java - Row: 104

In the row: new URL(tileURLString).openConnection(); - generates the error: java.io.IOException: Unable to find default handler for protocol: https

The value of tileURLString is: https://b.tile.openstreetmap.org/11/1062/730.png

I tried to follow the instructions on the official OSMDroid page (https://github.com/osmdroid/osmdroid) and I put the instructions in the network_security_config.xml file, but it still doesn't work.

I also tried installing the sample OSMDroid application and it works fine. My Android version is 9.0, but the same problem occurs on a device running Android 7.1. The impression is that my application cannot open the connection using the HTTPS protocol.

Has anyone had a similar mistake? How did he manage to fix it? Thank you all.

Michele



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source