Home > Enterprise >  How to develop in React Native using VirtualBox with Ubuntu as a development environment and Windows
How to develop in React Native using VirtualBox with Ubuntu as a development environment and Windows

Time:10-25

Have VirtualBox with Ubuntu Server.
I would like to create a ReactNative development environment there (install nodejs, npm, java, etc.) and run the build and run on the emulator npx reat-native start, npx react-native run-android. But the emulator itself should be on the main system Windows 10.

Do I need to use Android Studio to install the emulator, or can I use some other emulator? And how to implement such a bundle so that React Native and launch/build applications are on VirtualBox, and Android emulator is on Windows?

CodePudding user response:

You don't need to install Android Studio on Ubuntu. You should follow the React Native Environment Setup for Linux - Android except installing Android Studio and Java. And start the metro bundler with react-native start command.

On Windows, you need to follow React Native Environment Setup for Windows - Android. After setting up an emulator you need to build and install the app to your emulator. And now you can open the app on emulator and hit Ctrl M to open the React Native menu and select Change Bundle Location. Enter the IP address of your linux machine (or vm) and metro port (default to 8081) eg. 192.168.1.1:8081. Reload your app and you are good to go.

You can also use different emulators such as genymotion, up to you.

If you want to handle the build part on the linux too you need to install Android Studio for SDK, and Java. After building the app you need to manually install the apk file to your emulator on Windows.

  • Related