rn-fetch-blob
rn-fetch-blob copied to clipboard
android connect error when RNFetchBlob.fetch url includes localhost or 127.0.0.1
const url= `http://127.0.0.1:3000/api/info`
await RNFetchBlob.fetch('GET', url, {});
when running it on IOS virtual device, it works fine,
running it on Android virtual device,
if set url with http://127.0.0.1:3000/api/info , get an error: Failed to connect to /127.0.0.1:3000
if set url with http://localhost:3000/api/info , get an error: Failed to connect to localhost/127.0.0.1:3000
@liushmh brother you can set IP address local can't localhost , change localhost to IP address
Thanks, it works now
On Sun, Dec 27, 2020 at 1:28 PM Dadan Hamdani [email protected] wrote:
@liushmh https://github.com/liushmh brother you can set IP address local can't localhost , change localhost to IP address
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joltup/rn-fetch-blob/issues/704#issuecomment-751500895, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCROE5ZGJ6QLHQWVKBRT33SW54DVANCNFSM4VDL7MLA .
Thanks @dhamdani666
Afaik on Android you need to reference 10.0.0.2 in order to point to the host machine's localhost (from Android simulator). 127.0.0.1 is the virtual phone's localhost
Dude, ive been stuck on this trying every library for 10 hours straight until I found this.
Thank you magicleon94 and dhamdani666