Reputation: 63
I am working on a React Native project under a corporate proxy. How can I set it properly so that I can build the application (react-native run-android
or Double R
for reloading) and having access to internet on the device ?
PS : I'm using Windows and executing my code on a Android Emulator from Android Studio.
I tried multiple things ( https://medium.com/@Charles_Stover/create-a-react-native-app-on-an-android-emulator-1c0d94f288ae, ... ):
Without any configuration, the build works find but using fetch always returns a timeout (and accessing to chrome application, I do not have access to internet).
I configured the proxy in the wifi of the device (Settings > Network & Internet > Wi-Fi > AndroidWifi > Modify Network > Set Proxy
)
Manual
proxy.company.int
80
10.x.y.z, 192.168.x.y, localhost, *.local
I can access to internet (both in the previously built application and with Chrome) but could not either reload the application or rebuild it (a white screen appears).
I tried a lot of different things for no_proxy (based on ipconfig which gave me 2 IPs, one private (10.x.y.z) and one public (192.168.x.y). None of them worked so far.
I also tried to configure the parameters of Android Studio > File > Settings > Appearance & Behaviour > System Settings > HTTP Proxy
with the same config, without good results.
I also tried to configure the parameters of the device (not the wifi directly but the options in the toolbar next to the emulated device) : ... > Settings > Proxy > Use Android Studio HTTP proxy settings / no proxy / manual proxy configuration
.
Environment :
Windows 10 React-native 0.55.4 Android Studio 2.3.3
Thanks in advance
Upvotes: 0
Views: 6923
Reputation: 63
If you build an application with React Native on a simulator under a corporate proxy, make sure to :
10.0.2.2
(or any IP that is shown when trying to rebuild the application) in NO_PROXY :
Android Studio configAccess to the emulator config and make sure you use the configuration of Android Studio. You don't need to update the configuration inside the device (but it works if you want to set it only for one device) : Android Emulator Settings
Restart the emulator (just in case) and that's it
Upvotes: 2