Gradle setup for RajawaliVR with release or snapshot builds
Join 6000+ Students
Upgrade your programming skills to include Virtual Reality. A premium step-by-step training course to get you building real world Virtual Reality apps and website components. You’ll have access to 40+ WebVR & Unity lessons along with their source code.
Start Learning Now
This tutorial shows how to add the Android Gradle setup for Rajawali VR.
The Android build system compiles app resources and source code, and packages them into APKs that you can test, deploy, sign, and distribute. Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app. The Android plugin for Gradle works with the build toolkit to provide processes and configurable settings that are specific to building and testing Android applications.
Setup for RajawaliVR
Rajawali is a 3D engine for Android based on OpenGL ES 2.0/3.0. RajawaliVR integrates the Rajawali 3D framework with the Google Cardboard SDK v0.6.0.
RajawaliVR used to be a separate module and now is moved to the main Rajawali repository on Github.
Getting started with RajawaliVR
Create a new project in Android Studio:
If you have just installed Android Studio or have no open projects then select Start a new Android Studio project.
If you have already have a project open, select File > New > New Project
Configure the Android VR project
Set the application name as needed. For this sample we used RajawaliVR.
In the next step, we select the target version. Make sure the Minimum SDK is at least 16 because the cardboard SDK only supports API 16 (Android 4.1 Jelly Bean) onward.
Android Studio also provides a set of predefined templates for Activity class. Select the activity for the app as needed. For this basic sample we selected ‘Empty Activity’
Set the Activity Name and click on Finish.
Setting up Gradle files
The project will have two build.gradle files one for the Project (RajawaliVR) and the other for the module (app). These can be seen in the Gradle Scripts section
To use the release/snapshot builds, open the Project build.gradle file:
Add the following to allprojects repositories:
1 2 3 4 |
mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } |
This will allow Android Studio to connect to this Maven Server to retrieve a library.
Next we add the dependencies in the app module build.gradle file:
For release builds use:
1 2 3 4 |
compile 'org.rajawali3d:rajawali:x.x.x@aar' compile 'org.rajawali3d:vr:x.x.x@aar' |
Now we should see a note at the top asking you the sync the gradle. Click Sync Now and it should build. If it does not, you might want to recheck your code.
For snapshot builds use:
1 2 3 4 |
compile 'org.rajawali3d:rajawali:x.x.x-SNAPSHOT@aar' compile 'org.rajawali3d:vr:x.x.x-SNAPSHOT@aar' |
x.x.x is the version number (and the last number is the build number)
The latest release version as of this writing is 1.1.777 for both Rajawali and RajawaliVR. Snapshot version is 2.0.799 for Rajawali and 1.2.534 for RajawaliVR