Android Simulator NOT supported
ViroReact doesn't currently support the Android Simulator
Have you run through the Quick Start guide?
Run through steps 1-4 on the Quick Start guide before beginning this guide.
If you've completed the Quick Start guide, you should be set up and the HelloWorld project works on the Viro Media App. Your workspace should look similar to the following:
ViroSample/ ├── App.js ├── android ├── app.json ├── bin ├── index.android.js ├── index.ios.js ├── index.js ├── ios ├── js ├── node_modules ├── package.json ├── metro.config.js ├── rn-cli.config.js ├── setup-ide.sh
What each file/directory is for
- android - the directory containing the Android source
- app.json - miscellaneous React Native property file
- bin - contains various scripts
- index.android.js - legacy file that points to App.js to launch your application for Android
- index.ios.js - legacy file that points to App.js to launch your application for iOS
- index.js - entry file that points to the main application in App.js
- ios - directory containing the iOS source
- node_modules - directory containing all the node modules as specified by the package.json file
- package.json - file that tells node what modules are required
- metro.config.js - file that configures the React Native CLI / React Native's metro bundler (we use it to whitelist new file extension for the packager server)
- rn-cli.config.js - (LEGACY; used by older React Native bundler. This older config file would be removed in a subsequent version of react-viro) file that configures the React Native CLI (we use it to whitelist new file extensions for the packager server).
- setup-ide.sh - script used to automatically set up Xcode and Android Studio from scratch.
In a terminal window, navigate to your Viro project root (not Android project root) and run the following:
This will set up the Android project to work with Viro.
For Windows use our Windows Setup Diff file to modify your Android gradle and manifest files.
Android Studio is the IDE (Integrated Developer Environment) used for Android development and we will need it to run and test your Viro React application.
Android Studio requires a recent version of the JDK. If you don't have one installed, install one from here
Download and install Android Studio from here.
Ensure that Android Studio is configured with at least the following:
- Google APIs
- Android SDK Platform 28
- Sources for Android 28
by selecting Custom installation while installing Android Studio or by installing them from the SDK Manager under
Preferences -> Appearance & Behavior -> System Settings -> Android SDK
Building AR/ARCore With Android Studio
Open Android Studio, if you see a welcome screen, select
Open an existing Android Studio project, otherwise open the project with File -> Open.
When the file explorer menu appears navigate to your Project location and open the
Viro currently does not support development with the Android Emulator. You will need to develop with your device to use the Viro platform, at this time.
- Connect your device to your computer via USB. When a pop-up appears asking to "Allow USB Debugging?", select "OK".
- In your terminal, run this command
adb reverse tcp:8081 tcp:8081which will reverse tether your device to your development machine. (Note: the
adbcommand can be found under
platform-toolswherever your sdk is installed, it's recommended that you add this to your environment's $PATH variable.).
- Run 'npm start' from the project root directory to start the package server
- Ensure the target to the left of the green run button is set to "app" and tap on the green run button (see image below).
Run the application and you should see the Hello World scene.
Congratulations, you now have Viro set up and running!
On Android, we support 3 VR Platforms: Google Daydream, Samsung/Oculus GearVR and Google Cardboard. For the Viro Platform however, we only have 2 build flavors:
- GVR - for Google Daydream and Cardboard
- OVR_MOBILE - for Samsung/Oculus GearVR.
One way to toggle between the builds is to expand the
Build Variants panel on the left edge of your Android Studio window and select either
Another way to build your native app is from the command line. Since Viro was built with the goal of working like any other React Native package, you can take advantage of the React Native CLI to build, package and deploy your application to your device.
From the command line, you can run this command with one of the variants from your project's root directory:
react-native run-android --variant=<gvrDebug|ovrDebug>
to build your app for a selected variant.
Check out our Tutorial if you haven't yet gone through it!
Problems with installation? Need extra help? Post your issue here.
Updated about 2 years ago