To get started using ARCore with Android, you can run either the
**hello_ar_kotlin** or **hello_ar_java** sample app included with the ARCore
SDK. These sample apps use [OpenGL](https://en.wikipedia.org/wiki/OpenGL), a
programming interface for rendering 2D and 3D vector graphics. The apps display
any detected planes and allow the user to tap on a plane to place a 3D model.

## Set up your development environment

- Install [Android Studio](https://developer.android.com/studio/index.html)
  version 3.1 or higher with Android SDK Platform version 7.0 (API level 24)
  or higher.

- If you are new to Android, see
  [Building your first Android app](https://developer.android.com/training/basics/firstapp/index.html).

## Open a sample project

1. In Android Studio, clone the ARCore SDK GitHub repository.

   There are many ways to do this:
   - For an established Android Studio installation:

     - From the **Git** menu, select **Clone**.
     - In the **Version control** drop-down, select **Git** as the version control system.
     - In the **URL** field, enter the following URL to the ARCore GitHub
       repository:

       **https://github.com/google-ar/arcore-android-sdk.git**
   - You can also open a **Terminal** and issue the `git clone` command as
     follows:

     ```
     git clone https://github.com/google-ar/arcore-android-sdk.git
     ```
2. Open one of the sample projects as follows (you must explicitly open a
   project in order to build and run it).

   - From the **File** menu, select **Open**.
   - In the **arcore-android-sdk/samples** folder, select either the **hello_ar_kotlin** or **hello_ar_java** folder, and click **Open**.

## Prepare your device or emulator

You can run AR apps on a [supported device](https://developers.google.com/ar/devices) or
in the Android Emulator. You must update Google Play Services for AR
on the emulator before running the app. See
[Run AR Apps in Android Emulator](https://developers.google.com/ar/develop/java/emulator#update-arcore) for more
information.

## Run the sample

Make sure your Android device is connected to the development machine and click
**Run** ![](https://developers.google.com/static/ar/develop/java/images/toolbar-run.png) in Android Studio.

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](https://developer.android.com/studio/run/index.html).

You may be prompted to install or update [Google Play Services for AR](https://play.google.com/store/apps/details?id=com.google.ar.core)
if it is missing or out of date. Select **CONTINUE** to install it from
Google Play Store, or manually update it as described in
[Update Google Play Services for AR](https://developers.google.com/ar/develop/java/emulator#update-arcore).

The **hello_ar_java** app lets you place a three-dimensional ARCore pawn on
detected AR plane surfaces. It is implemented with [Android GL SurfaceView](https://developer.android.com/reference/android/opengl/GLSurfaceView),
which is used to render the camera preview and basic AR objects such as Planes
and Anchors. **hello_ar_java** 's sample rendering framework can be found in
[`com/google/ar/core/examples/java/common/samplerender`](https://github.com/google-ar/arcore-android-sdk/tree/master/samples/hello_ar_java/app/src/main/java/com/google/ar/core/examples/java/common/samplerender).

![](https://developers.google.com/static/ar/develop/java/images/hello-ar-demo.png)

> [!NOTE]
> **Note:** The lifecycle methods in **hello_ar_java** are different than those normally found in OpenGL applications. To ensure the correct AR setup for your own applications, follow the lifecycle management logic in **hello_ar_java**.

### Use Instant Placement

The [Instant Placement API](https://developers.google.com/ar/develop/instant-placement) allows the user to place an AR object on the screen without having to wait for ARCore to detect surface geometry. Object placement is refined in real time as the user moves further around the environment.

Tap on the screen to place an object. Make sure to continue moving the device
around after seeing the holographic object appear on screen, so that ARCore can
get sufficient data about your surroundings to accurately anchor the virtual
object.

Once ARCore detects the surface geometry and establishes a trackable in the
region where the object is placed, the object's pose is automatically updated
for accuracy.

![Instant Placement](https://developers.google.com/static/ar/images/instant-placement/instant-placement.png "Instant Placement")

In Figure 1, Instant Placement is disabled and surface geometry is undefined.
Objects placed on the floor to the right of the pool table (four small blue dots)
appear knocked-over, their poses are undefined.

In Figure 2, Instant Placement is enabled from the menu under the gear icon.

In Figure 3, with Instant Placement enabled, a new object is placed in the scene.
It appears in grayscale, instead of colored, to denote that it has not been
corrected for an accurate pose yet.

In Figure 4, the new object becomes colored, and its pose is accurate, when the
surface geometry (described by the *trackable* grid lines) is detected.

### Use Depth

When [Depth](https://developers.google.com/ar/develop/depth) is enabled, ARCore takes into account the geometry and location of objects in the scene, and computes the location of
objects placed in the scene relative to other objects in the scene. It allows
placed objects to be occluded by objects in the scene, and lends realism to
your app.

![Instant Placement](https://developers.google.com/static/ar/images/depth/depth.png "Instant Placement")

In Figure 1, Depth is disabled. An object is placed under the pool table.

In Figure 2, as the device moves around the pool table, the object appears
to follow the device irrespective of objects in the scene.

In Figure 3, Depth is enabled.

In Figure 4, the object now appears occluded by the pool table as the device
moves around the scene.

## Next steps

- Try building and running other [sample projects](https://github.com/google-ar/arcore-android-sdk/tree/master/samples) in the ARCore SDK.
- Check out the [Augmented Reality codelabs](https://codelabs.developers.google.com/?category=ar) for more sample apps that you can build and run.
- Learn how to [Enable ARCore](https://developers.google.com/ar/develop/java/enable-arcore) in your app.
- Review the [Runtime Considerations](https://developers.google.com/ar/develop/java/runtime).
- Review the [Design Guidelines](https://developers.google.com/ar/develop/developer-guides/design-guidelines).