Setting up ARCore doesn’t have to give you a headache. Building AR apps for your Android or other mobile device is easy — once you know how to setup ARCore and put your device into developer mode. Here’s how to start development on device.
You may have noticed that we’re fans of Vuforia. We encourage our students to use Vuforia for AR development because it allows you to build for Android, Apple, and Windows, and you can run it on older devices. But sometimes, you need to build something that takes advantage of platform-specific capabilities like Android’s ability to understand its position in the world. That’s awesome. We fully support you. If you’re building for Android, you’re eventually going to need to know how to use ARCore, and you’ve come to the right place.
(If you’re building for Apple, check out our guide to using ARKit with Unity!)
|Download our 10-week AR Development with Unity Course Syllabus|
Let’s Get Started: Downloads
The first thing we need to do is make sure you’re running the latest version of Unity (2017.2 or higher). Go to the Unity website and run the Unity download assistant, making sure “Android Build Support” is selected in the components list. This will prep Unity to let you develop in ARCore.
Create a new project. You know how to do this: the option is in the top righthand corner of the Unity launch screen. Once the project has opened, move into the Android development tools by heading over to File > Build Settings, selecting “Android” and clicking “Switch Platform.” Great. Now go ahead and open Preferences (in the top Edit menu). You’ll be given a prompt which includes the option to select “External Tools.” Do it!
Now scroll down until you see SDK and JDK. These are just acronyms for Software Development Kit (in this case, Android Studio) and Java Dev Kit. You just installed them, remember? Good.
On JDK, click “Browse,” and Unity will do a little search for the JDK you downloaded. Go grab yourself a coffee and enjoy the ease of automation. When you’re back, double check that Unity found the right location, then confirm.
Moving to Android Studio
Okay, get ready to forget about Unity for a minute and focus on Android Studio. Go ahead and open it, then click on “Configure” at the bottom of the prompt. When given the option, select “SDK Manager,” and the Android SDK location should appear at the top. If it doesn’t, you might already have it selected. Take a look at the selected location, and copy and paste it into a text document, because you’re going to need it later.
Right under the ASK location there is a tab for SDK Tools. Click that and then in the list check “Android SDK Build-Tools XX,” “Android SDK Platform-Tools,” “Android SDK Tools,” and click “Apply” and “OK” at the bottom of the window.
Back to Unity
In Unity, return to the Edit menu and select “Preferences,” then “External Tools.” You’re going to have to do the work yourself this time.
Click “Browse” on the SDK and find your Android SDK. The good news is that you’ve copied this path to make things easier on yourself. Open the text document where you pasted the path, copy it, and paste it into the Unity window. By default it will look something like this: C:\Users\YourUserName\AppData\Local\Android\Sdk.
In the File menu, choose “Build Settings,” then click on “Player Settings” on the bottom left of the prompt. In the inspector, you should be able to find a section that says “Other Settings.” Click on that to expand it, then uncheck the option for Multithreaded Rendering.
It’s time to name this thing. Navigate to “Package Name,” and give it a name. Be creative and call it something unique, but keep the same structure (com.something.something). Make sure you change the minimum API level to Android 7.0 or higher, to keep your app consistent with ARCore updates. Find your XR settings, expand the panel, and check “ARCore Supported.”
Okay. We’re almost done.
One More Download
Then head back into Unity. Once you’re there, find the Assets menu and click on “Import Package,” then “Custom Package.” Find the location of your ARCore SDK download, and import it.
In your Project tab, find the HelloAR Scene under GoogleARCore > Examples > HelloAR > Scenes. Open it up. Then open your File menu, select “Build Settings,” and click on “Add Open Scenes” in the prompt.
Build ARCore onto Your Phone
Okay, it’s time!
Plug in your phone, and make sure it’s unlocked and prepped for mobile development. Now build and run! Make sure you save the name.
If your version of tools downloaded by Android Studio doesn’t work properly, don’t panic. Solve the problem by downloading an older version here. Then go to your Android SDK directory, change the name of the current “tools” folder to something else like “toolsxxxx” and paste the tools that you just downloaded into the directory instead.
Need more help building your app? Check out our small group classes and 1:1 tutorials.
- Make sure you have Unity 2017.2 or higher installed and make sure to include android build support when installing.
- Download Android Studio.
- Download Java Dev Kit.
- Create a new project and then in Unity go to File>Build Settings and select android and click switch platform.
- Then go to Edit>Preferences then in the prompt click External Tools. Scroll down on until you see SDK and JDK.
- Click Browse on the JDK and Unity should locate your JDK itself pretty well and you can confirm.
- Open android studio and then click on configure at the bottom of the prompt and select SDK manager. The android SDK location should appear at the top (if you you have android SDK on the left selected, it is by default) Copy that location for later.
- Right under the ASK location there is a tab for SDK Tools, click that and then in the list check “Android SDK Build-Tools XX”, “Android SDK Platform-Tools”, “Android SDK Tools”, and click Apply and OK at the bottom of this window.
- Now go into Unity and return to Edit>Preferences>External Tools and this time click Browse on the SDK and find your android sdk, this is where you can paste your SDK path. By default it is in this directory: C:\Users\YourUserName\AppData\Local\Android\Sdk
- Go to File>Build Settings then click on Player Settings on the bottom left of the prompt. Then in the inspector you should be able to find a section that says Other settings click on that to expand it. Uncheck the option for Multithreaded Rendering.
- Then go to package name and change that something unique but keep the same structure com.something.something
- Change the minimum API level to Android 7.0 or higher
- Then go down to XR settings, expand it and check on ARCore Supported.
- Download the latest version of ARCore SDK for Unity.
- In Unity click on Assets>Import Package>Custom Package and navigate to where you downloaded the ARCore SDK Then import it to Unity.
- Then navigate in the project tab to the HelloAR Scene. GoogleARCore>Examples>HelloAR>Scenes. Open this scene up.
- Go to File>Build Settings and click on add open scenes in the prompt.
- Make sure your mobile device is plugged in, unlocked and prepped for mobile development. Then Build And Run! Save the name. A common problem is that the version of tools Android Studio downloaded for you doesn’t work properly. Download an older version that does from here. Then go to your Android SDK directory, change the name of the current “tools” folder to something else like “toolsxxxx” and copy paste the tools that you just downloaded into this directory.