Stay organized with collections Save and categorize content based on your preferences.
Use the Google VR SDK to build apps for Daydream and Cardboard. This guide shows you how to set up Android Studio for Google VR development and try out a sample app.
Set up your development environmentHardware requirements:
Daydream: You'll need a Daydream-ready phone and a Daydream View.
Cardboard: You'll need an Android device running Android 4.4 'KitKat' (API level 19) or higher and a Cardboard viewer.
Software requirements:
Android Studio version 2.3.3 or higher.
Android SDK 7.1.1 'Nougat' (API level 25) or higher.
In Android Studio, go to Preferences > Appearance and Behavior > System Settings > Android SDK (includes samples) to review or update installed SDKs.
The latest Google VR SDK for Android.
Extract the downloaded Google VR SDK into a convenient location.
Open Android Studio and select Open an existing Android Studio project.
Select the directory where you extracted the Google VR SDK.
In the Project window, review the sample gradle modules in gvr-android-sdk > samples:
Sample Description sdk-hellovr VR sample app in which you look for and collect objects. sdk-controllerclient Sample showing how to receive and handle Daydream controller input. sdk-simplepanowidget Widget to load a panoramic image from disk. See VR View guide. sdk-simplevideowidget Widget to render a 360 degree video usingVRVideoView
. See VR View guide. sdk-video360 Widget to render a 360 degree video. See video360 guide. sdk-videoplayer Sample activity for video playback using the Asynchronous Reprojection Video Surface API.Connect your phone to your machine using a USB cable.
In Android Studio, select Run > Run... and select the samples-sdk-hellovr target.
Android Studio compiles and runs the application on your phone.
Put your phone into your viewer and use the app.
The sample app shows the following core features of the Google VR SDK:
Feature Description Stereo rendering App views are rendered in stereo to create a 3D effect. Spatial audio Sounds come from different areas of the VR world, increasing its realism. Head movement tracking Users can move their heads to look around a VR world. Views update in response to head movement. User input Users can interact with the app using a Daydream controller or Cardboard button. Using Google VR in your own projectsTo use the Google VR SDK or NDK in your own projects, set up Google VR dependencies. If you are using ProGuard in your app, add rules to ensure that it does not obfuscate any SDK or NDK code.
Setting up Google VR dependenciesConfigure your project level build.gradle file:
jcenter()
repository location is declared.Declare an Android Gradle plugin dependency:
Google VR SDK projects: Use gradle:2.3.3
or higher.
Google VR NDK projects: Use gradle-experimental:0.9.3
or higher.
allprojects {
repositories {
jcenter()
}
}
dependencies {
// The Google VR SDK requires version 2.3.3 or higher.
classpath 'com.android.tools.build:gradle:2.3.3'
// The Google VR NDK requires experimental version 0.9.3 or higher.
// classpath 'com.android.tools.build:gradle-experimental:0.9.3'
}
Add Google VR SDK library dependencies in your module level build.gradle files. You can see available libraries and their versions in gvr-android-sdk > libraries.
As an example, review the dependencies
declared for the sample app in gvr-android-sdk > samples > sdk-hellovr > build.gradle.
dependencies {
// Adds Google VR spatial audio support
compile 'com.google.vr:sdk-audio:1.160.0'
// Required for all Google VR apps
compile 'com.google.vr:sdk-base:1.160.0'
}
For more information, see Add Build Dependencies in the Android Studio guide.
If you are using ProGuard to minimize your app's APK file, make sure that ProGuard does not obfuscate any Google VR SDK or NDK code. This makes it easier to debug stack traces in release builds.
Add the Google VR ProGuard proguard-gvr.txt rules to your module level build.gradle file:
android {
...
buildTypes {
release {
minifyEnabled true
proguardFiles.add(file('../../proguard-gvr.txt'))
}
}
}
Next steps
To learn more about the Google VR SDK, see the following resources.
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["Develop Daydream and Cardboard apps using the Google VR SDK with this guide, covering setup and a sample app."],["Set up your development environment with Android Studio, the Google VR SDK, and a Daydream-ready or Cardboard-compatible device."],["Explore the sample app, demonstrating features like stereo rendering, spatial audio, head tracking, and user input."],["Integrate the Google VR SDK into your own projects by setting up dependencies and configuring ProGuard for optimized builds."],["Access further resources for in-depth learning on Google VR development, including design principles, 6DoF tracking, and spatial audio."]]],["To develop Google VR apps for Daydream and Cardboard, set up Android Studio with the Google VR SDK. Extract the SDK, open it in Android Studio, and explore sample modules like `sdk-hellovr`. Enable developer options and USB debugging on your device. Connect your phone, run the `sdk-hellovr` sample app, and test it in your viewer. Integrate the Google VR SDK in your projects by configuring `build.gradle` files and adding dependencies. If using ProGuard, include `proguard-gvr.txt` rules.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4