Sceneform Quickstart for Android

Set up your development environment

Open the sample project

Get the sample projects. You can either:

  • Download and extract the Sceneform Samples

    -or-

  • Clone the repository with the following command:

    git clone https://github.com/google-ar/sceneform-android-sdk.git

In Android Studio, open the Hello Sceneformsample project, located in the appsubdirectory within the sceneform-android-sdk directory.

Prepare your device or emulator

You can run AR apps on a supported device or in the Android Emulator:

There are additional requirements to run Sceneform apps in the emulator:

  • You need Android Emulatorversion 27.2.9or later.
  • OpenGL ES 3.0or higher must be supported and enabled in the Android Emulator.

    • Make sure your emulator is configured to use the latest version. In the Extended controls panel (on the Toolbar), select Settings > Advanced > OpenGL ES API level > Renderer maximum (up to OpenGL ES 3.1), and then restart the emulator.

    • Run the emulator, briefly interact with the emulated deivce, then check whether OpenGL ES 3.0 or higher is being used:

       adb logcat | grep eglMakeCurrent 
      

      If you see ver 3 0 or higher version, then you can run Sceneform apps. If you see a lower version, then your desktop GPU does not support OpenGL ES 3.0 and you must use a supported device to run Sceneform apps.

Run the sample

Make sure your Android device is connected to the development machine and click Runin Android Studio. Then, choose your device as the deployment target and click OK.

Android Studio builds your project into a debuggable APK, installs the APK, and then runs the app on your device. For more information, see Build and Run Your App .

You may be prompted to install or update Google Play Services for AR if it is missing or out of date. Select CONTINUEto install it from Google Play Store.

The Hello Sceneformapp lets you place and manipulate Android figurines on flat surfaces.

Add Sceneform to an existing project

To use Sceneform in an existing project:

  1. Follow the steps to Enable ARCore in your app

  2. Add the Sceneform library to your app's build.gradle file:

      android 
      
     { 
      
     // 
      
     Sceneform 
      
     libraries 
      
     use 
      
     language 
      
     constructs 
      
     from 
      
     Java 
      
     8. 
      
     // 
      
     Add 
      
     these 
      
     compile 
      
     options 
      
     if 
      
     targeting 
      
     minSdkVersion 
     < 
     26. 
      
     compileOptions 
      
     { 
      
     sourceCompatibility 
      
     1.8 
      
     targetCompatibility 
      
     1.8 
      
     } 
     } 
     dependencies 
      
     { 
      
      
      
     // 
      
     Provides 
      
     ArFragment 
     , 
      
     and 
      
     other 
      
     UX 
      
     resources 
     . 
      
     implementation 
      
     'com.google.ar.sceneform.ux:sceneform-ux:1.15.0' 
      
     // 
      
     Alternatively 
     , 
      
     use 
      
     ArSceneView 
      
     without 
      
     the 
      
     UX 
      
     dependency 
     . 
      
     implementation 
      
     'com.google.ar.sceneform:core:1.15.0' 
     } 
     
    

Next steps

Create a Mobile Website
View Site in Mobile | Classic
Share by: