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 Studio 1.5 or later

  • Android NDK r10e

  • Android SDK with Build Tools at least version 20.0.0

  • Android API 23 (download from Android SDK Manager)

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

If you are new to Android Studio, you can read the official doc for reference.

http://tools.android.com/tech-docs/new-build-system

For the newly introduced NDK support since Android Studio 1.3, you can reference

http://tools.android.com/tech-docs/android-ndk-preview

According to the official description, it is highly possible that the NDK support will change across the next a few releases. We will follow-up the changes and provide samples using latest Android Studio when Google release a new stable version. We may not update this doc in SDK package, please always check EasyAR website for latest sample.

Please note EasyAR SDK do support building from Android Studio 1.4 or below, or from Eclipse. We choose Android Studio 1.5 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.

Open sample folder from Android Studio

../_images/image18.png

If it is the first time you are using the new Android Studio experimental plugin for Gradle, Android Studio may need some time to update its components.

You need to keep "Android" folder and "package" folder exist and keep their path relatively unchanged to build and run Android samples.

Set NDK location

After open the project, you will see an error message like this

../_images/image19.png

You can click the link in error message and set NDK location to this project like below

../_images/image20.png

If you are using an Android API or build tool different from the project setting, you may get an error like this

../_images/image21.png

To solve this, you can install the version proposed by the error message from Android SDK Manager or change build.gradle strings in the app folder below to match your version.

../_images/image22.png

Key

Follow below instructions to set the key.

../_images/image23.png

Run

Now you can run the sample by clicking the following button

../_images/image24.png