I am working on an android app. In my app i am using retrofit to GET and POST and data from a web service. If i am using WiFi, or if i am in certain place, i get a response and everything works fine. But, as soon as i switch to a mobile data, or I move to a different area, it stops working. I tried to debug and see the log cat, and the error i am getting is as follows:
2020-08-31 23:17:49.676 3470-3470/com.example.myscheduler W/Glide: Load failed for https://www.example.com/images/large_group2.png with size [289x289]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "www.example.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "www.example.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "www.example.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.net.UnknownHostException: Unable to resolve host "www.example.com": No address associated with hostname
Also, when on mobile data, it works if it is connected to VPN and stops working when disconnected from VPN. I have the Internet permission in the android manifest file. What should i do to solve this.
Any help would be a great help and much appreciated. Thank you in advance.