Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API requests to localhost on Android #168

Open
isaiahgrey93 opened this issue Sep 29, 2020 · 0 comments
Open

Fix API requests to localhost on Android #168

isaiahgrey93 opened this issue Sep 29, 2020 · 0 comments

Comments

@isaiahgrey93
Copy link
Contributor

Finally was able to resolve an issue I've dealt with in several apps where on the Android platform, requests to localhost do not resolve despite adb reverse being called correctly.
I was able to fix this issue by modify the environment variable while in dev mode (_DEV_ = true) by pointing at 10.0.2.2 instead of localhost :

if (__DEV__ && Platform.OS === 'android') {
  ENV.API_URL = API_URL.replace('localhost', '10.0.2.2');
}

We should add this to our default setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant