Compile and Run EasyAR Android Samples

This article shows how to run EasyAR non-Unity Android samples.

If you want to use EasyAR unity package, please read this for setup and this for samples.

If you want to setup EasyAR Android projects using EasyAR package, please read this instead.

Pre-Requirements

  • JDK 1.7 or later

  • Android NDK r10e or later (for c++ samples)

  • Android SDK with Build Tools at least version 23.0.1

  • Android API 23 (download from Android SDK Manager)

  • Android Studio 2.2 or later (Android Studio samples)

  • Visual Studio 2015 or later (Visual Studio samples)

It is recommended to install the latest version of NDK and SDK

Please note EasyAR SDK do support building from Android Studio 2.1 or below, or from Eclipse. We choose latest Android Studio for sample creation because it is the best tool for now that offers a simple way to configure and debug Android Java code and C++ code together.

Import sample to Android Studio

../_images/image21.png

You may need to wait Android Studio to finish download and configurations.

../_images/image22.png

There is no need to update Grade Plugin when it pops up, but you can update if you prefer.

Please note update Grade Plugin may require update Build Tools, if you meet any errors, follow the instructions given by Android Studio.

Setup NDK (c++ samples)

If you have not configured NDK for Android Studio before, you may see an error message like this

../_images/image23.png

Just click the link in error message and follow instructions, Android Studio will do the rest for you. Alternatively, you can put your local NDK into Android SDK and rename it to ndk-bundle.

Key

Find similar code in the samples as bellow, and follow instructions to set the key.

../_images/image24.png

Run

Now you can run the sample by clicking the following button

../_images/image25.png

Visual Studio Samples

Make sure to install C++ and Android support for Visual Studio, which are not selected by default on the first install.

Make sure to select and install Android SDK and NDK when installing Android support, or configure their locations after installation like this,

../_images/image26.png

Open solution file.

../_images/image27.png

Run the sample by clicking the green button when you have a real or virtual device connected.

../_images/image28.png