Issue
When i accessed my app on the browser i have no problem accessing data from API. But when i launch it on emulator on android studio, i can´t. It pops-up a card with a ERROR CODE :0, Message Ht failure with the referent link API.
I tried to add the allow-intent, change the "localhost" on API GET request to "127.0.0.1"... and more that i don't remember.
Even the DATA received by the server side is not accessible. Right now i'm inclined to think that is a proxy related issue or a CORS problem.
Solution
Problem Solved: Basically you need to change the url on your project where you do service. Change it from localhost:3000
to 10.0.2.2:3000
. The 3000
is the port's number, it doesn't need to be 3000
. Then you open android studio, open emulator and run it. On the litle tab right next to the android device, theres 3 dots at the end. Press those, then go to settings, and change proxy to 10.0.2.2
and the port number to the one you are using, in this case is 3000
. After that it will work. Sorry for late update on the problem!
For more info:
why do we use 10.0.2.2 to connect to local web server instead of using computer ip address in android client
Answered By - jcmendes98
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.