Flutter application suddenly has no internet connection at all

Viewed 668

I am running my application on Android emulator.

I verified the emulator itself has internet connection. I could browse via Google Chrome. 2 months ago everything worked as expected, and I didn't touch the code. Suddenly, when I run it I have no internet access via the application.

What I did:

  1. I verified I have the internet permission: <uses-permission android:name="android.permission.INTERNET"/> in: android/app/src/[main|debug|profile]/AndroidManifest.xml.
  2. flutter doctor - everything is fine.

Any advice? observe? I cannot understand why would I lost the internet connectivity

3 Answers

Reposting my comment, since it seemed to solve your issue.

In the past, I've faced such errors. In my case, it was caused by the antivirus software (namely, Kaspersky Antivirus) that ran on the host machine. Disabling it temporarily solved the issue entirely. Try disabling any antivirus software and see how it goes.

From the information you have shared, it's very difficult to give an exact answer. However you could try to troubleshoot the error. Try below thigs:

  1. Create a Webview inside your app and launch to any URL may be www.youtube.com
  2. Try fetching data from a public REST server API e.g. https://api.covidtracking.com/v1/us/daily.json

If youare able to receive the data from the above 2, then the problem is with your server else you should look into your app code.

I am not sure if I understood your question correctly, please consider adding some additional info.

However, I had a similar problem a while ago, for me it helped to delete the emulator device and simply add a new one. Alternatively, you can try wiping the emulator´s data (right click > wipe data). I don´t know how you verified that the emulator itself has internet connection, but maybe it helps.

Related