[Solved] How to solve SocketException: Failed host lookup: ‘flutter-project-xxxxx.firebaseio.com’ (OS Error: No address associated with hostname, errno = 7)

Hello Guys How are you all? Hope You all are fine. Whenever I try to do an HTTP call after about 20 seconds I get in the console the following error: SocketException: Failed host lookup: ‘flutter-project-xxxxx.firebaseio.com’ (OS Error: No address associated with hostname, errno = 7). So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How to solve SocketException: Failed host lookup: ‘flutter-project-xxxxx.firebaseio.com’ (OS Error: No address associated with hostname, errno = 7)

When I am Trying http call after 20 seconds I get error in my console log the following error:

E/flutter ( 8274): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 8274): SocketException: Failed host lookup: 'flutter-project-xxxxx.firebaseio.com' (OS Error: No address associated with hostname, errno = 7)

I am Using http package in my project.

How to solve This error ?

Question : How to solve SocketException: Failed host lookup: ‘flutter-project-xxxxx.firebaseio.com’ (OS Error: No address associated with hostname, errno = 7) ?
Answer : This Error cause of Internet Permission in your AndroidManifest.xml file as given below and make sure you are online whether it is mobile or emulator.

Solution 1 : Adding Internet Permission

This Error cause of Internet Permission in your AndroidManifest.xml file as given below and make sure you are online whether it is mobile or emulator.

  1. Open android/app/src/main/AndroidManifest.xml file.
  2. add this line in your file.
  3. <uses-permission android:name="android.permission.INTERNET"/>
  4. Re-run flutter app.
  5. and Make sure you are online whether it is mobile or emulator.

Solution 2 : Make Sure Mobile Data Is Active In Emulator.

If you are using an emulator make sure that the mobile data is active

Solution 3 : Enabled wifi

When I enabled WIFI on my device, it worked fine.

Solution 4 : Check This All Below Point.

  • Make sure the internet is on (both on the phone and the PC)
  • also, make sure the server is working properly
  • check your URL properly

Summery

So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.

Check Out Below Article

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment