How to fix the error ClientException with SocketException: Host search failed:

Hi everyone, I have a Flutter application that extracts data from a MySql table using a PHP script. It works perfectly.

For a few days now, if I recompile the application, it gives me this error when I launch the apk: “Error: ClientException with SocketException: Host search failed: 'www.miosito.it (Operating system error: No address associated with the host name, errno= 7), url=https: //www.miosito.it/script/prova.php”.

But if I run it with the emulator it works perfectly.

I created a very simple new page where I call a PHP script that basically does nothing and just responds ‘OK’. Same error. It works with the emulator but when compiled it doesn’t.

I did all the tests and checked all the permissions on AndroidManifest.xml. I also tried replacing

If I launch the script from the browser it works perfectly.

It seems like once filled out it can’t resolve the address.
I also reinstalled AndroidStudio, Flutter etc… on a new machine but nothing changed.

My configuration is this:

Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.19045.5011], locale it-IT)

Windows Version (Installed version of Windows is version 10 or higher)

Android toolchain - develop for Android devices (Android SDK version 35.0.0)

Chrome - develop for the web

Android Studio (version 2024.1)

Thanks for the help!

do you get this error only in debug or also in release mode?

2 Likes

+1 check internet permission in release manifest

1 Like