When I build android debug release the app points to the metro bundled on port 8081. I have to run out metro bundles on port 8087 due to antivirus software occupying port 8081. How do o build android debug with the app pointing to port 8087 for the metro bundler?
Asked
Active
Viewed 346 times
0
-
1Hi, is this really a detox question? How do you normally do it when running the app in debug, regardless of tests execution? – d4vidi Dec 09 '20 at 13:50
-
It sure is a detox question. Normally to run in the android simulator i start the metro bundler "react-native start --port 8087" and then with the simulator running i run "adb -s emulator-5554 reverse tcp:8081 tcp:8087 && react-native run-android --port 8087". So how do i run the detox build command with a port flag? or how would i change the default port it uses to point to the metro bundler to 8087? The concern i have is that the detox build is looking for the metro bundler on port 8081. I couldn't find in the docs any info on how to change that? Have i missed it? – Timothy Doolan Dec 10 '20 at 10:31
-
Thanks, I now understand the use case better. Normally, I would advise using Detox' [port-reversal API](https://github.com/wix/Detox/blob/master/docs/APIRef.DeviceObjectAPI.md#devicereversetcpport-android-only), which is equivalent to `adb reverse`. However, it does not support different device and host ports, ATM. That can be easily solved - the only thing required is that you submit a more specific issue on github, or even offer a pull request (which would be much appreciated). – d4vidi Dec 13 '20 at 08:55
-
For the time being, you can directly use node's [`exec` API](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback), to roughly run this command in one of the before-all's (as you see fit): `await exec(\`adb -s ${device.id} reverse tcp:8081 tcp:8087\`);` – d4vidi Dec 13 '20 at 08:56