Fragment - TileLoader failed to load tile due to mWriter being null (Message displayed after onPause and onResume)

26 Views Asked by At

I'm currently developing an android apk which needs the map. I'm using the library osmdroid. org.osmdroid:osmdroid-android:6.1.17

I'm also using fragments (2 only) and the mapView is inside the first fragment. When I end up on the first fragment after sign in the map is working correctly, but once I switch to another fragment, the logcat indicate

TileLoader failed to load tile due to mWriter being null (map shutdown?)

It happens during the onPause method and also during the onResume. And the issue is that once I switch back to the first fragment, the map doesn't load anymore and only grey tiles are displayed.I set my map to zoom at the lvl 17 (so it shouldn't be an issue since it's not past 20)

I tried multiple answers found online but to no avail and I'm now at a loss on what to do. Any help is appreciated, thank you in advance !

I tried to override the method onPause and onResume to add map.pause()/map.resume(). I also tried to add the network_security_config.xml file and add it to the Manifest.

<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">openptmap.org</domain>
    </domain-config>
</network-security-config>

I also tried to add the line Configuration.getInstance().setUserAgentValue(ctx.getPackageName()); but again to no success. I also tried to switch to other TileSource than MAPNIK.

0

There are 0 best solutions below