Android Application Development: How to build ARCore Android App

Android Application Development: How to build ARCore Android App

In my previous article, I have talked about installing the android studio in the system and the simple Hello World application in android. Today, we are going to talk about how we can develop the AR android application using Sceneform Android Library. So, let’s dig into it.

Step 1: Create a new project

You can refer my previous android article that how you can create a new project.

Select the Java programming language.
Choose the ‘MINIMUM SDK’ as ‘API 24: Android 7.0 (Nougat)’

Step 2: Getting the 3D Model

Sceneform 1.17.0 supports only glTF files. Now .glb files are the binary versions of the GL Transmission Format. These types of 3d models files are used in VR, AR because it supports motion and animation.

In the android studio, Right-click on the res directory. Go to New > Android Resource Directory. Change the Resource Type to Raw: Click OK. A raw folder will be generated in the res directory. You have to place the glb file in the raw directory.

  • You can create 3d model by yourself in the computer graphics software and save it in .glb format.
  • You can download the .glb model from the Google Poly website or from sketchfab. I have used the gladiator .glb file from the sketchfab.

Step 3: Downloading and Setting up SceneForm 1.16.0.

For developing the AR app in android Sceneform SDK is required.

  • Download the “” file.
  • Extract the ‘sceneformsrc‘ and ‘sceneformux‘ folders in your project folder.
  • Go to the Android Studio
  • Go to Gradle Scripts > settings.gradle (Project Settings)
include ‘:sceneform’

project(‘:sceneform’).projectDir = new File(‘sceneformsrc/sceneform’)

include ‘:sceneformux’

project(‘:sceneformux’).projectDir = new File(‘sceneformux/ux’)

After that go to Gradle Scripts > build.gradle (Module:app). Add this line inside the dependencies block.

api project(“:sceneformux”)

After all, these changes click ‘Sync Now‘. Then go to the app > manifests > AndroidManifest.xml. Add these lines before the “application” block

<!--This permits the user to access Camera-->
<uses-permission android:name="android.permission.CAMERA" />
<!--This helps to check a specific feature in the phone's hardware, 
    here it is OpenGlES version. Sceneform needs OpenGLES Version 3.0 or later-->
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<!--Indicates that this app requires Google Play Services for AR.
    Limits app visibility in the Google Play Store to ARCore supported devices-->
<uses-feature android:name="" android:required="true"/>

After that add this line before the “activity” block.

<!-- ARCore need to be installed, as the app does not include any non-AR features. 
     For an "AR Optional" app, specify "optional" instead of "required".-->
<meta-data android:name="" android:value="required" />

Step 4: Some Error Correction

Currently, android development is supporting the androidx library. Sceneform SDK is built on the andoid compat library which is not supported longer anymore. So you have to go migrate the SDK to androidx by going to Refactor > Migrate to AndroidX.

Step 5: Working with layout file.

Go to the res > layout > activity_main.xml file. Here is the code of that XML file:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=""

        app:layout_constraintTop_toTopOf="parent" />


Step 6: Working with coding part

package com.example.androidar;


import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;


import java.util.Objects;

public class MainActivity extends AppCompatActivity {

    private ArFragment arFragment;

    private int clickNo = 0;

    public static boolean checkSystem(Activity activity) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            String openGlVersion = ((ActivityManager) Objects.requireNonNull(activity.getSystemService(Context.ACTIVITY_SERVICE))).getDeviceConfigurationInfo().getGlEsVersion();

            if (Double.parseDouble(openGlVersion) >= 3.0) {
                return true;
            } else {
                Toast.makeText(activity, "App needs OpenGl Version 3.0 or later", Toast.LENGTH_SHORT).show();
                return false;
        } else {
            Toast.makeText(activity, "App does not support required Build Version", Toast.LENGTH_SHORT).show();
            return false;

    protected void onCreate(Bundle savedInstanceState) {

        if (checkSystem(this)) {

            arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(;
            Objects.requireNonNull(arFragment).setOnTapArPlaneListener((hitResult, plane, motionEvent) -> {
                if (clickNo == 1) {
                    Anchor anchor = hitResult.createAnchor();
                            .setSource(this, R.raw.gladiador)
                            .thenAccept(modelRenderable -> add(anchor, modelRenderable))
                            .exceptionally(throwable -> {
                                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                                builder.setMessage("Somthing is not right" + throwable.getMessage()).show();
                                return null;

    private void add(Anchor anchor, ModelRenderable modelRenderable) {
        AnchorNode anchorNode = new AnchorNode(anchor);
        TransformableNode model = new TransformableNode(arFragment.getTransformationSystem());

That’s it you have done very good work. Now it’s time to install the app on your android. Click on the run button. It will start compiling code. If you are lucky then error won’t come.


I have created the app you can download it from here. OR you if you want to do the coding, I have created a git repository clone it to your machine and open the project in android studio and run it. It will install on your android device.