0
Good night,
I have an API in Laravel that is only running locally through Valet and I am developing a mobile APP in Flutter where I intend to make requests to that same Laravel API.
I have already installed all the necessary plugins, however when I try to make a request to the API through the APP I just get this error:
I/flutter (25634): SocketException: Failed host lookup: 'pede-new.test' (OS Error: No address associated with hostname, errno = 7)
According to what I searched online I’ve added this line:
<uses-permission android:name="android.permission.INTERNET" />
on Androidmanifest.xml but I still have this problem.
If I try to request through Postman I have no problem and everything works right.
Note: As an emulator I am using a cable-connected physical device.
Thanks in advance for your help.
According to the error "has no address associated with the hostname you passed"... Because it is a request coming from mobile, you should put the IP of your machine instead of
127.0.0.1
, Are you doing this? And your phone has to be on the same network as your API– Matheus Ribeiro
https://stackoverflow.com/a/40018505/4623423 Take a look here or see the IP of the machine running the Laravel application.Assuming the ip is 192.168.1.X, at the root of the application runs a >> php Artisan serves --host 192.168.1.X
– Marcos Xavier