Mobile SDK

To become acquainted with the Oculus VR environment and with using Gear .... In your activity's onCreate method, add the following line: ... Bitmapfon...

1 downloads 54 Views 8MB Size

Recommend Documents


Mobile SDK
For detailed instructions on updating native projects to this SDK version, see Mobile ..... Once downloaded, extract the .zip file into a directory of your choice (e.g., ...... against VrApi, then calls nativeSetAppInterface() to allow the C++ code t

Mobile SDK
In theory, Gear VR applications may receive messages from System ...... 112 | Testing and Troubleshooting | Mobile or .... GLSL_ES_Specification_3.00.3.pdf ..... For projects which rely on the 3rdParty libraries, minizip or stb, the following ...

Mobile SDK
Native application framework for building high-performance VR Applications from scratch. ... Native project sample applications and source to provide reference model ... Mobile Development Basics: Information every developer should know about ......

Mobile SDK
As this is a significant API refactor, please refer to the Unity Development Guide: ... Menu localization support: English, French, Italian, German, Spanish, Korean. ..... Note: As of October 2014, the Windows x86 version of the JDK appears to be ...

Mobile SDK - Oculus
push notifications, or authentication via a separate Android application) do not make sense on Oculus Go. • No Camera. Oculus Go does not have a camera, and ...

Audio SDK
than the dimensions of a typical human head, allowing us to rely on timing ...... The Oculus Spatializer Plugin (OSP) is an add-on plugin for FMOD Studio that ...

PC SDK
The Oculus Debug Tool moved from the SDK to the runtime. The new ...... WPA is included in the Windows Assessment and Deployment Kit (Windows ADK): ..... can see that all of the GPU time used by the server is applied toward rendering:.

PC SDK
This guide describes major changes since the last release, provides instructions ... reason, and for future improvements, we recommend submitting depth data with your eye buffers. ...... profile, implement head-tracking, sensor fusion, stereoscopic 3

Mobile
obtain additional information. Enforcement. Corrective action must occur within 15 business days, unless otherwise provided. We may impose a fine for each day ...

Audio SDK
ignoring localization, if we are unable to compensate for head motion, then sound .... Bluetooth technology is not recommended for audio output. ... By the same token, an .... paradoxically make things seem less realistic, as we are conditioned by ..

Mobile SDK Version 0.5.1

2 | Introduction | Mobile

Copyrights and Trademarks ©

2017 Oculus VR, LLC. All Rights Reserved.

OCULUS VR, OCULUS, and RIFT are trademarks of Oculus VR, LLC. (C) Oculus VR, LLC. All rights reserved. BLUETOOTH is a registered trademark of Bluetooth SIG, Inc. All other trademarks are the property of their respective owners. Certain materials included in this publication are reprinted with the permission of the copyright holder.

2 |  | 

Mobile | Contents | 3

Contents Introduction to Mobile VR Development............................................................ 5 Getting Started.................................................................................................................................................. 5 System and Hardware Requirements................................................................................................................ 5 SDK Contents.................................................................................................................................................... 6 Application Signing............................................................................................................................................8 VrPlatform Entitlement Checks..........................................................................................................................8 Contact...............................................................................................................................................................9

0.5 Release Notes..............................................................................................10 Device and Environment Setup......................................................................... 14 Introduction...................................................................................................................................................... 14 Install the SDK............................................................................................................................................14 Device Setup....................................................................................................................................................14 Setting up your System to Detect your Android Device...........................................................................14 Configuring your Android Device for Debugging..................................................................................... 15 Android Development Environment Setup..................................................................................................... 16 Android Development Software Setup for Windows................................................................................ 16 Android Development Software Setup for OS X...................................................................................... 22 Troubleshooting............................................................................................................................................... 28 Device Troubleshooting............................................................................................................................. 28 Environment Troubleshooting.................................................................................................................... 29

Mobile VR Application Development................................................................ 32 Introduction to Mobile VR Design.................................................................................................................. 32 Performance Advice for Early Titles...........................................................................................................32 Frame Rate................................................................................................................................................. 33 Scenes.........................................................................................................................................................33 Resolution................................................................................................................................................... 34 Hardware Details..............................................................................................................................................34 Universal Menu................................................................................................................................................ 35 Reserved User Interactions.........................................................................................................................35 Implementation Overview.......................................................................................................................... 36 Runtime Threads.............................................................................................................................................. 36 Power Management.........................................................................................................................................37 Fixed Clock Level API................................................................................................................................ 37 Power Management and Performance...................................................................................................... 38 Power State Notification and Mitigation Strategy..................................................................................... 39 Front Buffer Rendering.................................................................................................................................... 40 TimeWarp.........................................................................................................................................................40 TimeWarp Minimum Vsyncs....................................................................................................................... 41 Consequences of not rendering at 60 FPS............................................................................................... 41 TimeWarp Chromatic Aberration Correction............................................................................................. 42 TimeWarp Debug Graph............................................................................................................................42 User Interface Guidelines................................................................................................................................ 43 In a Word: Stereoscopic!........................................................................................................................... 43 The Infinity Problem................................................................................................................................... 43 Depth In-Depth.......................................................................................................................................... 44 Gazing Into Virtual Reality..........................................................................................................................44

4 | Contents | Mobile

Media and Assets.............................................................................................. 46 Mobile VR Media Overview............................................................................................................................ 46 Introduction................................................................................................................................................ 46 Panoramic Stills...........................................................................................................................................46 Panoramic Videos....................................................................................................................................... 46 Movies on Screens..................................................................................................................................... 47 Media Locations......................................................................................................................................... 49 Oculus Media Applications..............................................................................................................................49 Native VR Media Applications................................................................................................................... 49 Oculus Cinema Theater Creation....................................................................................................................51 How to Create and Compile a Movie Theater FBX.................................................................................. 51 Detailed Instructions...................................................................................................................................52 FBX Converter..................................................................................................................................................57 Overview..................................................................................................................................................... 57 Command-Line Interface............................................................................................................................ 60 Optimization............................................................................................................................................... 62

Native Development Guide...............................................................................64 Introduction...................................................................................................................................................... 64 Native Samples................................................................................................................................................ 64 SDK Sample Overview............................................................................................................................... 64 Importing Native Samples in Eclipse.........................................................................................................64 Native Source Code........................................................................................................................................ 66 Overview..................................................................................................................................................... 66 Native User Interface..................................................................................................................................67 Input Handling............................................................................................................................................68 Native SoundManager..................................................................................................................................... 68 Creating New Native Applications..................................................................................................................69 Template Project Using The Application Framework................................................................................ 69 Integration with Third-Party Engines..........................................................................................................70 Android Manifest Settings..........................................................................................................................70 Migrating from Earlier Versions.......................................................................................................................71

Testing and Troubleshooting.............................................................................73 Oculus Testing Tools and Procedures............................................................................................................ 73 Developer Mode: Running Apps Outside of the Gear VR Headset..........................................................73 Oculus Remote Monitor............................................................................................................................. 73 Local Preferences....................................................................................................................................... 79 Android Debugging.........................................................................................................................................80 Adb............................................................................................................................................................. 80 Logcat......................................................................................................................................................... 82 Application Performance Analysis................................................................................................................... 83 Performance Analysis................................................................................................................................. 83 Application Performance............................................................................................................................ 83 Rendering Performance: Tracer for OpenGL ES....................................................................................... 85

Previous Release Notes..................................................................................... 88 0.5 Release Notes............................................................................................................................................88 0.4 Release Notes............................................................................................................................................91

Revision.............................................................................................................. 95

Mobile | Introduction to Mobile VR Development | 5

Introduction to Mobile VR Development Welcome to mobile application development for Gear VR! This section will help you get oriented to the world of VR development before you jump in.

Getting Started To become acquainted with the Oculus VR environment and with using Gear VR, we recommend beginning with the Samsung Gear VR User Manual, which covers topics including: • • • •

Health and Safety Device Features and Functionality Connecting the Headset Navigation and App Selection

Ready to start developing? The Device and Environment Setup Guide will lead you through setting up and configuring your development environment. We recommend that all developers review the Mobile VR Application Development guide for performance guidelines and best practices. Unity developers: focus on the Unity Integration Guide (available at the Developer Site). Native developers: focus on the Native Development Guide (included in this document). For both Native and Unity development, we also recommend: • Android Debugging • Performance Analysis and Performance Guidelines • Design Guidelines You will find Gear VR app submission instructions and other helpful documents at https:// developer.oculus.com. Thank you for joining us at the forefront of virtual reality!

System and Hardware Requirements Please begin by making sure that you are using supported hardware and devices for this release of the Oculus Mobile SDK v0.5. Operating System Requirements The Oculus Mobile SDK currently supports Windows 7 and Mac OS X.

6 | Introduction to Mobile VR Development | Mobile

Minimum System Requirements The following computer system requirements for the Oculus Mobile SDK are based on the Android SDK system requirements: • • • •

Windows 7 Mac OS: 10.6+ (x86 only) 2.0+ GHz processor 2 GB system RAM

Supported Devices • Samsung Note 4 Target Device Requirements • API Level • 19 (Android 4.4.2) • VR Hardware • 3.0 Class 2 Bluetooth gamepad (see below) Bluetooth Gamepad A Bluetooth gamepad (3.0 Class 2) is necessary for testing the sample applications which come with this release. You may use the Samsung El-GP20 gamepad or a Moga Pro, or another compatible gamepad. For more information about the Samsung El-GP20, including specifications and key bindings, see the following: http://developer.samsung.com/s-console. Bluetooth Keyboard It is useful (but not required) to have a Bluetooth keyboard during development. The Logitech K810 is known to function well.

SDK Contents Included with this SDK, you will find the following: • VrLib, the native framework for building high-performance VR Applications. • Unity Standalone Integration for adding the VR framework to your Unity project. • Example native and Unity Projects with source to provide a model for creating your own VR applications. • Several pre-built sample applications, some implemented in native and some in Unity. Sample Applications and Media Note: The sample applications included with the SDK are provided as a convenience for development purposes. Some of these apps are similar to apps available for download from the Oculus Store. Due to the potential for conflict with these versions, we do not recommend running these sample apps on the same device on which you have installed your retail Gear VR Innovator experience. Please take care to secure the retail media content bundled with the SM-R320. It will be difficult if not impossible to replace.

Mobile | Introduction to Mobile VR Development | 7

Table 1: Sample Native Applications Application

Description A viewer for panoramic stills.

Oculus 360 Photos A viewer for panoramic videos.

Oculus 360 Videos Plays 2D and 3D movies in a virtual movie theatre.

Oculus Cinema Loads a scene which can be navigated using a gamepad.

VrScene Table 2: Sample Unity Applications Application

Description A simple game example in which blocks can be thrown to knock over structures and collect stars.

BlockSplosion An example app that renders a scene and character from Shadowgun by Madfinger Games.

Shadowgun, by Madfinger Games

8 | Introduction to Mobile VR Development | Mobile

For the Mobile SDK, we have limited pre-loaded media. Please add your own media by consulting the following table and media creation guidelines for compatibility: Table 3: Sample Media Application

Path for Media on the SD Card

Oculus Cinema - 2D Movie

Movies\ DCIM\ Oculus \Movies\My Videos

Oculus Cinema - 3D Movie

Movies\3D DCIM\3D Oculus\Movies\My Videos \3D

Oculus 360 Video - 360-degree panoramic video

Oculus\360Videos

Oculus 360 Photo - 360-degree static Oculus\360Photos photos Note: non-360 degree photos will not render properly. For more information on media management, see Mobile Media VR Overview.

Application Signing Application signing is a key part of the development process. All mobile VR applications must be signed by an Android digital certificate in order to install and run on an Android device, and they must also be signed with an Oculus Signature File (osig) during development to gain complete access to the phone's full VR capabilities. For more information on application signing, see "Create Your Signature Files" in the Oculus Mobile Submission Guidelines.

VrPlatform Entitlement Checks Mobile SDKs v0.4.3 and later include support for entitlement checking with VrPlatform. This feature is typically used to protect applications sold through the store from unauthorized distribution. During an entitlement check, the application's package name is compared with a list of applications that the currently logged-in user is entitled to use. This check is performed invisibly and automatically with the Oculus background service. If the application package name is not found on the user's entitlement list, the application is killed, and Home automatically launches to display an error message. If the check runs into any error, applications are treated as though an entitlement were not found, in order to prevent circumvention. Possible failures in this check are: 1. 2. 3. 4.

No service installed/problem connecting to service. Invalid service signature. Calling app is neither developer (osig) nor VR signed. No user logged in.

Mobile | Introduction to Mobile VR Development | 9

5. User is not entitled. Note: Entitlement checking may be left enabled during development, as any development build with a valid osig file will automatically skip the check. When Oculus signs your package for release, we will test the integration to confirm that your application's entitlement is verified correctly. Native: Java Copy the vrplatlib.jar library from /sdk/VRPlatform/libs/ into your project's /libs/ directory and add to your project's build path. In your activity's onCreate method, add the following line: OVREntitlementChecker.doAutomatedCheck(this);

Native: C++ Follow the procedure described in the “Native: Java” section above. Every native project must subclass VrActivity. This is usually called MainActivity, so add the entitlement check in the onCreate as with Java. Unity Entitlement checking is disabled by default in Unity. To enable entitlement checking: 1. Select Edit > Project Settings > Player. 2. In the PlayerSettings window, select the Android icon and expand the Other Settings tab. 3. In the Scripting Define Symbols field, add USE_ENTITLEMENT_CHECK. Verifying Entitlement Integration You can verify your integration by checking the logcat output after starting your app. For example: D/OVREntitlementChecker(19779): Package oculussig verified, entitlement check was skipped.

Note: The term "oculussig' is equivalent to "osig."

Contact Questions? Visit our developer support forums at https://developer.oculus.com. Our Support Center can be accessed at https://support.oculus.com/.

10 | 0.5 Release Notes | Mobile

0.5 Release Notes This document provides an overview of new features, improvements, and fixes included in the version 0.5 of the Oculus Mobile SDK. 0.5.1 Overview of Major Changes This document provides an overview of new features, improvements and fixes that are included in this distribution of the Oculus Mobile SDK. The most significant change in 0.5.1 is to System Activities event handling in Unity. The 0.5.0 code for handling System Activities events in Unity was doing heap allocations each frame. Though this was not a leak, it would cause garbage collection to trigger much more frequently. Even in simple applications, garbage collection routinely takes 1 to 2 milliseconds. In applications that were already close to dropping below 60 Hz, the increased garbage collection frequency could cause notable performance drops. The event handling now uses a single buffer allocated at start up. Other notable changes were to HMT sensor prediction — specifically clamping of the delta time used for prediction. Without this change delta times on application startup could sometimes be huge, causing an apparent jump in screen orientation. Unity Developers: As with Mobile SDK v 0.5.0, Unity developers using this SDK version must install the Oculus Runtime for Windows or OS X. This requirement will be addressed in a future release of the SDK. Note: Before installing or integrating this distribution, we strongly recommend that you backup your project before attempting any merge operations. API Changes • Sensor Prediction: Make sure Predicted deltaTime can never be negative or become huge. • Sensor Prediction: Clamp delta time used for sensor prediction to 1/10th of a second instead of 1/60th so that we don’t under-predict if the target frame rate is not being met. • Better handling for a case where SystemActivities resumes without an explicit command. This can happen if the top app crashes or does a finish() instead of launching Home to exit. Bug Fixes • Unity Integration • Rework System Activities Event handling to prevent any per-frame allocations that could trigger Garbage Collector. • Native Framework • Fixed potential MessageQueue deadlock • Bitmapfont - Fix case where billboarded text is right on top of the view position and results in a zerolength normal vector. • Bitmapfont - Fix for font info height not being y-scaled. • Renamed VERTICAL_BOTTOM to VERTICAL_BASELINE because it aligns to the first row’s baseline rather than the bottom of the entire text bounds. • Bitmapfont - Fix for VERTICAL_CENTER_FIXEDHEIGHT to correctly account for the ascent / descent when rendering single and multi-line text. • VrMenu Fader - Update only performed if frame time is > 0.0f.

Mobile | 0.5 Release Notes | 11

• VrMenu - Add ProgressBar component. • VrMenu - Parent / child rotation order in menus was backwards, causing confusion when local rotations were used. • VrMenu - Don’t use an old view matrix to reposition menus on a reorient. Since we reorient to identity (with respect to yaw) we should reposition with respect to identity instead of the last frame’s view matrix. • AppLocal::RecenterYaw() now adjusts lastViewMatrix so that it instantly reflects the recenter of the sensor fusion state. • FolderBrowser - Allow implementers to create their own panel object. Known Issues • Application version number remains 0.5.0 and was not incremented to 0.5.1. This does not affect app functionality and will be addressed in a future release. • For use with the Mobile SDK, we recommend Unity versions 4.6.3. The Mobile SDK is compatible with Unity 5.0.1p2, which addresses a problem with OpenGL ES 3.0, but there is still a known Android ION memory leak. Please check back for updates. 0.5.0 Overview of Major Changes The Universal Menu has been removed from VrLib, allowing modifications to the Universal Menu without requiring each app to upgrade to the latest SDK. The Universal Menu is now part of the Oculus System Activities application and is downloaded and updated alongside Oculus Home and Horizon. Make sure you update your version of Home in order to test your application with the new Universal Menu. If you are migrating from a previous SDK, please refer to the “Migrating from Earlier Versions” sections of the Native Development and Unity Integration guides. The Mobile Unity Integration is now synced with the Oculus PC SDK 0.5.0.1 Beta. Please ensure you have installed the corresponding 0.5.0.1 Oculus runtime; it can be found at the following location: https:// developer.oculus.com/downloads/ VrPlatform entitlement checking is now disabled by default in Unity; handling for native development is unchanged. If your application requires this feature, please refer to the Mobile SDK Documentation for information on how to enable entitlement checking. Applications built with Mobile SDK 0.5.0 or later will be compatible with the Samsung GALAXY S6. Note: Before installing or integrating this distribution, we strongly recommend that you back up your project before attempting any merge operations. New Features • Android Manifest • Mobile SDK 0.5.0 no longer requires PlatformActivity in the AndroidManifest.xml file. If you have previously worked with an earlier SDK, the following block must be removed:

12 | 0.5 Release Notes | Mobile

• The camera permission is also no longer required and can be removed from your manifest if your app does not rely on it:

• For additional information on manifest requirements, see the relevant documentation in the Native Development Guide, Unity Integration Guide, and Mobile App Submission Guide. • Native Framework • Folder Browser • Added support for dynamically loaded categories. • Factored out MetaData from FolderBrowser into MetaDataManager.h/cpp. • Improved wrap-around controls. • Sound Limiter • Application sound_asset.json files may now override specific menu sounds. • VrMenu • Added hit test result to VRMenuEvent. • Added debugMenuHierarchy console command for debug drawing of VrMenu hierarchy. • Now uses current view matrix for gaze cursor and menu positions. • Added options for horizontal and vertical text justification. • Multi-Line text justification. • Added option to allow text to line up horizontally with different descenders. • Unity Integration • Synced with the Oculus PC SDK 0.5.0.1 Beta. • VrPlatform entitlement checking is now disabled by default. • Cinema SDK • UI reworked using new UI components. • 360 Photos SDK • Added libjpeg.a directly to projects in order to avoid dependency on libjpeg source. • Metadata is now app-extensible. Added functionality for reading and writing extended metadata during app loading and saving. • 360 Videos SDK • Added libjpeg.a directly to projects in order to avoid dependency on libjpeg source. • Metadata is now app-extensible. Added functionality for reading and writing extended metadata during app loading and saving. API Changes • VrLib • • • • •

Universal Menu moved from VrLib into a separate application. Universal Menu specific functionality removed from VrLib. Adds Oculus Remote Monitor support. VrApi restructured for future modularity and ease of development. Local preferences are now allowed in Developer Mode. Please refer to the Mobile SDK Documentation for more information.

Mobile | 0.5 Release Notes | 13

• Default eye height and interpupillary distance have been changed to conform to the default values used by the PC SDK. • The native head-and-neck model has been re-parameterized to use a depth/height pair rather than angle/length to conform to the PC SDK. • HMDState sensor acquisition code has been re-written to make it reliable and thread safe. • Now restores last-known good HMD sensor yaw when recreating the HMD sensor. Bug Fixes • Unity Integration • Health and Safety Warning no longer displays in editor Play Mode if a DK2 is not attached. • Cinema SDK • Fixed playback controls reorienting screen in void theater when user clicks on controls when they are off the screen on portrait videos. • OvrGuiSys • RemoveMenu is now DestroyMenu and will now free the menu. Known Issues • Unity Integration • For use with the Mobile SDK, we recommend Unity versions 4.6.3, which includes Android 5.0 Lollipop support as well as important Android bug fixes. While the Mobile SDK is compatible with Unity 5.0.0p2 and higher, several issues are still known to exist, including an Android ION memory leak and compatibility issues with OpenGL ES 3.0. Please check back for updates.

14 | Device and Environment Setup | Mobile

Device and Environment Setup A guide to setting up your device and environment for mobile VR application development.

Introduction Welcome to the Oculus VR Mobile Software Development Kit! This SDK will demonstrate how to implement high-performance, high-quality and fully-immersive virtual reality applications for Samsung Gear VR.

Install the SDK

Begin by installing the mobile SDK archive. The mobile SDK is composed of a compressed archive in .zip format which contains both source and media files: ovr_mobile_sdk_.zip. Once downloaded, extract the .zip file into a directory of your choice (e.g., C:\Oculus\Mobile).

Device Setup This section will provide information on how to setup your supported device and gamepad for running, debugging, and testing your Gear VR application. Please review the System and Hardware Requirements above for the list of supported devices for this SDK release. Note: This information is accurate at the time of publication of this document. Unfortunately, we cannot guarantee the consistency or reliability of any of the third-party applications discussed in these pages, nor can we offer support for any of the third-party applications we describe.

Setting up your System to Detect your Android Device

You must set up your system to detect your Android device over USB in order to run, debug, and test your application on an Android device. If the device is not automatically detected by your system when connected over USB, you may need to manually update the drivers. More information can be found in the “Using Hardware Devices” section at http:// developer.android.com/tools/device.html.

Windows If you are developing on Windows, you need to install a USB driver for adb. For an installation guide and links to OEM drivers, see the Android OEM USB Drivers document. Samsung Android drivers may be found on their developer site: http://developer.samsung.com/android/toolssdks/Samsung-Android-USB-Driver-for-Windows Windows may automatically detect the correct device and install the appropriate driver when you connect your device to a USB port on your computer. However, if Windows is unable to detect your device, you may

Mobile | Device and Environment Setup | 15

still need to update the drivers through the Windows Device Manager, even if your device was automatically detected. Access the Device Manager through the Windows Control Panel. If the device was automatically detected, it will show up under Portable Devices in the Device Manager. Otherwise, look under Other Devices in the Device Manager and select the device to manually update the driver. To verify that the driver successfully recognized the device, open a command prompt and type the command: adb devices

Note: You will need to successfully setup your Android development environment in order to use this command. For more information, see the next section: Android Development Environment Setup If the device does not show up, verify that the device is turned on with enough battery power, and that the driver is installed properly.

Mac OS

If you are developing on Mac OS X, you do not need to install USB drivers. Your Samsung device may display a notification recommending you install Android File Transfer, a handy application for transferring files between OS X and Android.

Configuring your Android Device for Debugging

In order to test and debug applications on your Android device, you will need to enable specific developer options on the device.

Developer Options Developer options may be found under: Home -> All Apps -> Settings -> System -> Developer options. Developer options may be hidden by default. If so, you can expose these options with the following steps: 1. Go to Home -> All Apps -> Settings -> System -> About device. 2. Scroll down to Build number. 3. Press Build number seven times. You should be informed that Developer options has been enabled. Once you have found Developer options, enable the following: USB Debugging: This will allow the tools to install and launch deployed apps over USB. You should see the screen shown on the accompanying figure.

16 | Device and Environment Setup | Mobile

Note: If the above screen does not appear, ensure that your system recognizes the device and toggle USB Debugging off then back on. Check Always allow this computer and hit OK. To purge the authorized whitelist for USB Debugging, press Revoke USB debugging authorizations from the Developer options menu and press OK. Allow mock locations: This will allow you to send mock location information to the device (convenient for apps which use Location Based Services). Verify apps via USB: This will check installed apps from ADB/ADT for harmful behavior.

Display Options The following display options are found in: Home -> Apps -> Settings -> Sound and Display. Lock screen/Screen Security/Screen lock: Set to None to make the Home screen is instantly available, without swipe or password. Useful to quickly get in and out of the phone. Display/Screen timeout: Set the time to your desired duration. Useful if you are not actively accessing the device but wish to keep the screen awake longer than the default 30 seconds. See Android Debugging for more information.

Android Development Environment Setup This section describes setup and configuration of the Android Development Environment necessary for building Oculus Android mobile applications. Note: As of February 2015, Android has officially deprecated the Eclipse-based SDK in favor of the Android Studio system. We are in the process of updating our developer instructions for integration with their new IDE. Until that is complete, we recommend that developers continue to download and install the tools and versions referenced in this guide. When this guide was published, they were still available from download at the specified addresses. Please check back for updates.

Android Development Software Setup for Windows In order to develop Android applications, you must have the following software installed on your system: 1. Java Development Kit (JDK) 2. Android Development Tools (ADT) Bundle

Mobile | Device and Environment Setup | 17

3. Android Native Development Kit (NDK) 4. Apache Ant

Java Development Kit (JDK)

The Java Development Kit is a prerequisite for the Android Eclipse IDE (which comes with the ADT Bundle) as well as Apache Ant. The latest version which has been tested with this release is JDK 8u11. You may download the appropriate version for your OS from the following location: http://www.oracle.com/technetwork/java/javase/downloads/ java-archive-javase8-2177648.html Note: As of October 2014, the Windows x86 version of the JDK appears to be incompatible with Eclipse and cannot be used. Once downloaded and installed, add the environment variable JAVA_HOME, which should be set to the JDK install location. Depending on where it was installed, it may look like: • C:\Program Files\Java\jdk1.8.0_11 if you have installed the x64 version, or • C:\Program Files (x86)\Java\jdk1.8.0_11 if you have installed the x86 version. Make sure your JAVA_HOME variable does not include quotation marks. Based on the default installation path of Java SE 8u11, the correct syntax when using set from the command line is: set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_11

Do not use quotes with the set command, even though the path has a space in it. Also, be sure to use your actual path, which may differ from these examples.

Android Development Tools Bundle The Android Development Tools (ADT) Bundle includes everything needed to begin developing Java Android Apps: • • • • •

Android SDK Tools Android Platform Tools Latest Android Platform Eclipse with integrated ADT Plugin Latest System Image for Emulator

The ADT bundle comes in either a 32-bit or 64-bit version. This must match the JDK option you selected above. Download the appropriate version of the ADT Bundle at the following locations: • 32-bit .zip download • 64-bit .zip download Once downloaded, unpack the zip file and save to your Android development folder, e.g.: C:\Dev\Android\adt-bundle-\ Add the ADT SDK tools and platform-tools to your PATH, e.g. • C:\Dev\Android\android_adt_bundle_20140702\sdk\tools • C:\Dev\Android\android_adt_bundle_20140702\sdk\platform-tools Add the environment variable ANDROID_HOME which should be set to your Android SDK location, e.g.:

18 | Device and Environment Setup | Mobile

• C:\Dev\Android\android_adt_bundle_20140702\sdk set ANDROID_HOME=C:\Dev\Android\adt-bundle-windows-x86-20140702\sdk

Installing Additional Packages and Tools

The Android SDK does not include everything you will need for development by default. You must download additional packages via the SDK Manager before you begin. Note: Before launching the SDK Manager, make sure you have installed the JDK as outlined above. SDK Manager may fail to launch if it has not been installed. 1. Launch the Android SDK Manager located at: C:\Dev\Android\adt-bundle-\SDKManager.exe You may also launch it via Eclipse by selecting the SDK Manager in the toolbar. 2. Under the Tools section within Packages, select the following (if they are unselected): • Android SDK Tools Rev. 23.0.5 • Android SDK Platform-tools Rev. 21 • Android SDK Build-tools Rev. 20 3. Our current Android build target is Android 4.4.2 (API 19). Select at least the following under the API 19 section: • SDK Platform • ARM EABI v7a System Image • Sources for Android SDK (optional, but invaluable for dealing with the Android API) 4. Finally, under Extras at the bottom, select the following: • Android Support Library Rev. 21.0.1

Mobile | Device and Environment Setup | 19

• Google USB Driver Rev. 11 Figure 1: Android SDK Manager

5. Open Android 4.4.2 (API 19) and select the items for SDK Platform and ARM EABI v7a System Image. Note that Oculus Mobile SDK projects use API level 19.

20 | Device and Environment Setup | Mobile

6. Click Install X Packages, where X is the number of selected packages (it may vary based on what needs to be updated). 7. On the next dialog, choose Accept License. 8. Click Install to install and update packages. You may install additional packages above API 19 if you wish. Android SDK Tools 23.0.2, Android SDK Platform-tools 20 and Android SDK Build-tools 20 have all been verified to work correctly with the SDK. If you have problems compiling after an update, close the Android SDK Manager and re-open it to make sure you have everything required for the installed packages. In some cases you may get the warning “Could not load definitions from resource emma_ant.properties”. This is usually due to missing components in the install or improper file permissions. If the problem persists after verifying everything is up to date, try deleting the local.properties files from your project folders and updating them in each project folder with the command: android update project -p .

Then rebuild.

Verify Eclipse Configuration

Verify that Eclipse has the proper location for your Android Development Tools. Launch the Eclipse executable which came with the ADT bundle, e.g.: C:\Dev\Android \android_adt_bundle_20140702\eclipse\eclipse.exe. 1. In the Eclipse menu go to Window -> Preferences -> Android. 2. The Android Preferences SDK Location should be set to the location where you installed the ADT bundle SDK in the previous section, e.g.: C:\Dev\Android\android_adt_bundle_20140702\sdk.

Android Native Development Kit

The Android Native Development Kit (NDK) is a toolset that allows you to implement parts of your app using native code languages such as C and C++. It is used extensively by the sample applications which come with this release. 1. Download the latest version of NDK at the following location: https://developer.android.com/tools/sdk/ndk/ index.html 2. Once downloaded, install NDK to your Android development folder, e.g.: C:\Dev\Android\android-ndk-r10c \. 3. Add the NDK location to your PATH, e.g.: C:\Dev\Android\android-ndk-r10c\. 4. Add the environment variable ANDROID_NDK, which should be set to your Android NDK location, e.g.: C: \Dev\Android\android-ndk-r10c. set ANDROID_NDK=C:\Dev\Android\android-ndk-r10c

Configure Eclipse for NDK Usage 1. Start Eclipse from the location it was installed to, e.g.: C:\Dev\Android\adt-bundle-windowsx86_64-20140702\eclipse\eclipse.exe. 2. Download and install the Eclipse ADT Plugin. 1. In the Eclipse menu go to: Help -> Install New Software. 2. Click Add in the top-right corner. 3. In the Add Repository dialog that appears, enter “ADT Plugin” in the Name field and the following URL: https://dl-ssl.google.com/android/eclipse

Mobile | Device and Environment Setup | 21

4. Click OK. 5. 6. 7. 8.

In the Available Software dialog, select the checkbox for Developer Tools and click Next. Click OK. In the next window, you will see a list of tools to be download. Click Next. Read and accept the license agreements, then click Finish. Click OK if you get any prompts regarding the security and authenticity of the software. 9. When the installation completes, restart Eclipse. 3. Configure the NDK path: 1. In the Eclipse menu, go to: Window -> Preferences -> Android. 2. Under Android, select NDK. 3. Set the NDK Location field to the directory where the NDK is installed.

If the NDK option under the Android section is missing, something went wrong with the Eclipse ADT Plugin installation. Full instructions and troubleshooting information may be found here: http:// developer.android.com/sdk/installing/installing-adt.html#Troubleshooting

Apache Ant

Apache Ant is a Java library and command-line build system. It provides a number of built-in tasks which simplify building Java projects. The Apache Ant project is part of the Apache Software Foundation. The latest version which has been tested with this release is Apache Ant 1.9.3 and is available for download at the following location: http://ant.apache.org/bindownload.cgi Note: The Ant download page is explicit about verifying the Ant binary, but this is not strictly necessary for using Ant or for getting Android development up and running. Once downloaded, unpack the zip file and save to your Android development folder, e.g.: C:/Dev/Android/ apache-ant-1.9.3. Next, add the Ant bin folder to your PATH, e.g.: C:\Dev\Android\apache-ant-1.9.3\bin.

22 | Device and Environment Setup | Mobile

For more information on using Ant to automate building Android Apps, see: http:// www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html

Android Development Software Setup for OS X In order to develop Android applications, you must have the following software installed on your system: 1. 2. 3. 4.

Xcode Android Development Tools (ADT) Bundle Android Native Development Kit (NDK) Apache Ant Note: The tilde character followed by a forward slash (~/) is shorthand for the current user’s home folder. It is used throughout this section.

Xcode

Before installing any Android development tools, you must install Xcode. Once Xcode is installed, some of the following steps (such as installing Apache Ant or the JDK) may be unnecessary - some versions of OS X (10.5 and later) include Apache Ant, and some do not. On Mavericks 10.9, Ant does not appear to be installed by default or included with Xcode 5.0.2.

Java Development Kit

The Java Development Kit (JDK 8) is a prerequisite for the Android Eclipse IDE (included with the ADT Bundle) as well as Apache Ant. Install the JDK if it is not already present on your system. If you already installed Xcode, this step may be unnecessary. The latest version tested with this release is JDK 8 - it may be downloaded at the following location: http:// www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html.

Android Development Tools Bundle

The Android Development Tools ADT Bundle includes almost everything needed to begin developing Android Apps. The ADT Bundle includes: • • • • •

Android SDK Tools Android Platform Tools Latest Android Platform Eclipse with integrated ADT Plugin Latest System Image for Emulator

1. In your home folder, create a new folder named “dev”. To get to home folder in OS X, open Finder and press CMD+Shift+H. 2. Download the ADT package at http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip. 3. Once downloaded, unzip the ADT archive (if necessary) and save to your “dev” folder. 4. Browse to ~/dev/adt-bundle-/eclipse and double-click the Eclipse icon. You may receive a warning like the following:

Mobile | Device and Environment Setup | 23

Note: Please refer to Apple’s knowledge base regarding this security feature and safeguards for apps downloaded and installed from the internet. 5. To remedy this, right click the Eclipse icon and choose Open. You will get a warning again, but it will now present an Open option:

6. Select Open to start Eclipse. If you get a message that Eclipse needs JRE 6 in order to run, allow it to download and install JRE 6. Next, you should see a window asking you to select your workspace:

7. Select Browse and locate or create the directory for your workspace:

8. If you plan to always use this same workspace, you can select the checkbox labeled Use this as the default and do not ask again. Choose OK.

Installing Additional Packages and Tools

The Android SDK does not include everything you will need for development by default. You will need to download additional packages via the SDK Manager before you begin.

24 | Device and Environment Setup | Mobile

In Eclipse go to Window -> Android SDK Manager to open a window similar to the following:

1. Note that some packages are already selected for installation by default. Leave these projects selected. 2. If not already selected under Tools, select Android SDK Tools, Android SDK Platform-tools, and Android SDK Build-tools. 3. Open Android 4.4.2 (API 19) and select the items for SDK Platform and ARM EABI v7a System Image under it. 4. Click Install X Packages, where X is the number of selected packages (it may vary based on what needs to be updated). 5. On the next dialog, choose Accept License. 6. Click Install to install and update packages. You may install additional packages above API 19 if you wish. Android SDK Tools 23.0.2, Android SDK Platform-tools 20 and Android SDK Build-tools 20 have all been verified to work correctly with the SDK.

Android Native Development Kit

The 2.4 Android Native Development Kit (NDK) is a toolset that allows you to implement parts of your app using native code languages such as C and C++. It is used extensively by the sample applications which come with this release. The latest version which has been tested with this release is NDK 10 - it is available for download at the following location: https://developer.android.com/tools/sdk/ndk/index.html. Once downloaded, extract the NDK to your home/dev folder (~/dev). Your dev folder should look something like the following:

Mobile | Device and Environment Setup | 25

Note that the ADT bundle and the NDK are extracted into their own folders within the Dev folder (in this case, folders that were in the root of their archive). The names of the folders, where the ADT bundle and the NDK reside, are not vitally important. As long as they are in separate folders and are not extracted directly into the Dev folder, any conflict between the two packages can be avoided. It is recommended you use the above naming scheme so that there is no question which version of the ADT bundle and the NDK are installed. You can read more about installation and use of the NDK here: http://developer.android.com/tools/sdk/ndk/ index.html#installing.

Configure Eclipse for NDK Usage 1. Launch Eclipse and go to the Eclipse -> Preferences window. 2. Under Android, verify that Eclipse knows the location of the Android Development Tools. If the NDK option is missing in the Preferences -> Android section, update the Eclipse ADT Plugin as follows. 1. Download and install the Eclipse ADT Plugin. a. In the Eclipse menu go to: Help->Install New Software. b. Click Add in the top-right corner. c. In the Add Repository dialog that appears, enter “ADT Plugin” in the Name field and the following URL: https://dl-ssl.google.com/android/eclipse d. Click OK. e. In the Available Software dialog, select the checkbox for Developer Tools and click Next. f. Click OK. g. In the next window, you will see a list of tools to be download. Click Next. h. Read and accept the license agreements, then click Finish. Click OK if you get any prompts regarding the security and authenticity of the software. i. When the installation completes, restart Eclipse. 2. Configure the NDK path. a. In the Eclipse menu go to: Window -> Preferences -> Android. b. Under Android select NDK. c. Set the NDK Location field to the directory where the NDK is installed.

26 | Device and Environment Setup | Mobile

3. Under Android -> NDK set the NDK folder to the location where you installed the NDK:

4. To set environment variables specifying the locations of Android SDK and NDK on your system, and to add Android tools to your global path: 1. Launch a terminal.

Mobile | Device and Environment Setup | 27

2. At the prompt type the following three lines: echo ‘export echo ‘export echo ‘export ANDROID_NDK’

ANDROID_HOME=~/dev/adt-bundle-mac-x86_64-20140702/sdk’ >> ~/.profile ANDROID_NDK=~/dev/android-ndk-r9c’ >> ~/.profile PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ >> ~/.profile

5. To verify that the Android NDK environment is set up correctly, launch a new terminal and go to the samples/hello-jni folder in the Android NDK. Execute the command ndk-build, which will compile the sample hello-jni application if everything is set up correctly.

Apache Ant

Apache Ant is a Java library and command-line build system. It provides a number of built-in tasks which simplify building Java projects. The Apache Ant project is part of the Apache Software Foundation. 1. Download Apache Ant here: http://ant.apache.org/bindownload.cgi. If you have already installed Xcode, you may be able to skip this step. The latest version which has been tested with this release is Apache Ant 1.9.3. 2. Once downloaded, unzip Ant (or copy/move it if your web browser auto-expands .zip files for you) into your Dev folder alongside the ADT bundle and the NDK. As with the other packages, Ant should be in its own folder within Dev. 3. Set environment variables to specify the locations of JRE and ADT on your system, and add Ant to your path. 1. Launch a terminal 2. Type the following three lines at the prompt: echo ‘export ANT_HOME=~/dev/apache-ant-1.9.3’ >> ~/.profile echo ‘export JAVA_HOME=$(/usr/libexec/java_home)’ >>~/.profile echo 'export PATH="$PATH":~/dev/apache-ant-1.9.3/bin' >> ~/.profile

For additional information about the JAVA_HOME folder and how to determine its location, see: • http://stackoverflow.com/questions/18144660/what-is-path-of-jdk-on-mac • http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/ 4. Verify the $PATH variable and *_HOME variables are set correctly. 1. Launch a new terminal window (from Terminal, press Cmd+N). BE SURE to do this from a new Terminal window. The original Terminal window where you set the environment variables will not have an updated version of the environment variables, because it hasn’t re-run ~/.profile. 2. At the prompt type: echo $PATH

3. You should see the full path with your Ant bin folder at the end. 4. At the same terminal window prompt, type: echo $ANT_HOME

5. Verify the Ant home path is the folder you installed it to. This particular path should NOT have /bin on the end. 6. To ensure the Ant binaries are accessible through the path, type ant -version 7. You should see the Ant version information output as in the screen capture below.

28 | Device and Environment Setup | Mobile

If you receive any errors, verify that the paths are all correct. If you have to correct anything, you can edit the ~/.profile file from Terminal using the following command: sudo nano ~/.profile

You should see something like the following screen where you can use the arrow keys to navigate the file and edit text:

When you are finished editing, press Ctrl+X to save, answer Y to overwrite, and press Enter to select the current file.

Troubleshooting Troubleshooting your device and environment.

Device Troubleshooting Troubleshooting your Samsung device.

View is tilted If the headset view is tilted to the left or right, there is probably an issue with sensor calibration. Take off the headset and place it face down on a flat surface for around 5 seconds to prompt the device to reorient the sensors. When you put the device back on your head, the view should be level.

Device not (or no longer) recognized Even if a device worked fine previously, it may enter a state in which it is no longer recognized. When using Windows you may get the following dialog:

Mobile | Device and Environment Setup | 29

In most cases, rebooting the device should be sufficient. Windows appears to sometimes auto-update or auto-rollback the correct Samsung USB driver when the phone is reconnected. If this occurs, you should see a Windows notification that it is installing a driver when you connect your phone via USB. Should this happen, reinstall the correct driver.

Device regularly reconnects The device may enter a state in which it reconnects regularly, or in the middle of sessions. In Eclipse you may get the following message: [

Life Enjoy

" Life is not a problem to be solved but a reality to be experienced! "

Get in touch

Social

© Copyright 2013 - 2019 DOKUMENTIX.COM - All rights reserved.