Google VR for Android - Getting Started(SDK)

Getting Started

This document describes how to get started using the Google VR for Android SDK by building and running one of our sample apps on your Android device.

本文档介绍了如何开始使用谷歌的VR为Android SDK通过建立和Android设备上运行我们的样本应用程序之一开始。


Treasure Hunt sample app

寻宝示例应用程序

You will build the Treasure Hunt app, which uses the following features of the Google VR SDK:

Binocular rendering: A split-screen view for each eye in VR.

Spatial audio: Sound seems to come from specific areas of the VR world.

Head movement tracking: The VR world view updates as the user moves their head.

Trigger input: The user can interact with the VR world by pressing a button.

In this game, you'll look around the game world to find and collect objects as quickly as possible. It's a basic game, but it demonstrates the core features of the Google VR SDK.

您将构建寻宝的应用程序,它使用了谷歌VR SDK的以下特点:

双目视觉效果:在VR每只眼睛分屏视图。

空间音频:声音似乎来自世界VR的特定区域。

头部运动跟踪:本VR世界观更新在用户移动他们的头。

触发输入:用户可以通过按下一个按钮与VR世界的互动。

在这个游戏中,你将看到游戏世界中四处打听,并尽快回收对象。这是一个基本的游戏,但它表明了谷歌VR SDK的核心功能。


Open and run Treasure Hunt

打开并运行寻宝

Prerequisites

Building the sample app requires:

Android Studio, 1.0 or higher.

Version 23 of the Android SDK.

Gradle 23.0.1 or higher. Android Studio will allow you to upgrade if your installed version is too low.

A physical Android device running Android 4.4 (KitKat) or higher.

Download the sample code

Clone the sample app from the gvr-android-sdk GitHub repository by running the following command:

git clone https://github.com/googlevr/gvr-android-sdk.git

先决条件

构建示例应用程序需要:

AndroidStudio,1.0或更高版本。

Android SDK版本23。

Gradle是23.0.1或更高版本。如果你安装的版本太低,Android Studio将会让你升级。物理Android设备运行Android4.4或更高版本。

从GVR-Android的SDK的GitHub库上克隆示例应用程序并运行以下命令:

git克隆地址:https://github.com/googlevr/gvr-android-sdk.git

Build the sample app

构建样例app

1.Open Android Studio. On theWelcome to Android Studioscreen, chooseOpen an existing Android Studioproject, and select theandroid-sdkdirectory. Android Studio will display the various gradle modules on theProjecttab on the left side and the various run targets on the top toolbar.


Google VR for Android - Getting Started(SDK)_第1张图片

打开AndroidStudio。在Android Studio欢迎界面,选择打开现有的Android Studio项目,并选择Android的SDK目录。 AndroidStudio将显示在左侧的项目选项卡和顶部工具栏上的各种运行指标上的各种模块的gradle。

Connect your phone to your machine, select the samples-treasurehunt target and click Run to compile and run the application on your phone.

For more information about the code behind the Treasure Hunt game, see our explanation of it in the samples section.

将你的手机连接到你的机器,选择samples-treasurehunt,然后单击运行编译和运行,在你的手机上运行应用程序。

有关寻宝游戏背后的代码的详细信息,请参阅我们的样品部分它的解释。


Start your own project

开始你自己的项目

Using Android Studio

利用Android Studio

After you've read up on the Google VR SDK for Android, it'll be time to create your own applications. Here's how.

在你读了Google VR SDK for Android之后,是时间创建你自己的应用程序了,从这儿开始。

First, grab all the required .AAR files from the libraries folder of the sdk. To determine which .AARs you need to depend on, you can examine the build.gradle files of the various sample apps. For example, samples/treasurehunt/build.gradle's dependency section has the following entries:

dependencies {

compile project(':libraries-audio')

compile project(':libraries-common')

compile project(':libraries-core')

}

This indicates that an application similar to the Treasure Hunt sample needs the audio, common, and core libraries.

Create new modules for each of these libraries. Using Android Studio's GUI, this can be done via File -> New -> New Module. Select Import .JAR/.AAR Package. Locate one of the .AARs and import it.

Then add this new module as a dependency to your main app via File > Project Structure > Modules (on the left side's section list) > YOUR APP's MODULE NAME > Dependencies (on the right side's tab list) -> '+' -> Module Dependency.

Once this is done for all of the required libraries, you will be able to reference code in the Google VR SDK in your app.

首先,从sdk的libraries文件夹找到所有需要的.AAR文件。要确定需要依赖于哪个.AARs,你可以检查各种示例应用程序的build.gradle文件。例如,samples/ treasurehunt /build.gradle的依赖部分有如下条目:

dependencies {

compile project(':libraries-audio')

compile project(':libraries-common')

compile project(':libraries-core')

}

这表明,与寻宝示例应用程序类似,需要audio, common, core librarises.

为这些库的创建新的模块。使用Android Studio的图形用户界面,这可以通过File - >New - >New Module。选择导入.JAR / .AAR包。找到.AARs之一,并将其导入。

然后,作为一个依赖通过File>Project Structure>Module(左边的部分名单)>YOUR APP'S Moudle Name>Dependencies(右边的选项卡列表中) - >'+' - >Moudle Dependency(模块依赖模块),添加这个新的模块到你的主应用程序。

一旦这是所有所需的库完成后,你就可以在你的应用程序中引用了谷歌VR SDK代码。


Directly using Gradle

直接使用Gradle

Using the steps above will cause Android Studio to generate new modules and edit your .gradle files automatically. Alternatively, you can directly include the .AARs in your application's module by editing that specific module's build.gradle file and adding the following entries:

使用上面的步骤将导致Android Studio中生成新的模块,并自动编辑.gradle文件。或者,你可以直接通过编辑特定模块的build.gradle文件并添加以下条目包含应用程序的模块中的.AARs:

dependencies{

compile(name:'audio',ext:'aar')

compile(name:'common',ext:'aar')

compile(name:'core',ext:'aar')

}

repositories{

flatDir{

dirs'libs'

}

}

这将告诉Gradle是在你的模块的库子目录三个.AARs。创建模块的目录内的库子目录,然后复制.AARs那里。您将需要为您的每一个Moudle重复使用那些.AARS,这会导致您的项目有的很多重复。


All right reserved

你可能感兴趣的:(Google VR for Android - Getting Started(SDK))