TL;DR

Seriously, TL;DR

No, really, this is pointlessly verbose. Click Here

I like Unity. It's pretty easy to get started, there's a ton of assets available, and it builds for... well... everything. It isn't always smooth sailing though. Enter building for Android.

I've been working on a top-down space shooter and I want to start working on touch controls before I get too many features. I open up build settings and switch build to Android, I give Unity a minute to reconfigure the project and assets.

I'm building for mobile, every bit of extra performance counts, so I figure I'll just start off using the IL2CPP scripting backend and I only want to allow Landscape orientations, so I pop open Player Settings and make those changes. I hit Build and Unity asks me to install some dependencies.

It asks where my Android SDK is? I point it in the right direction: C:\Users\danie\AppData\Local\Android\Sdk

It asks where my JDK is. I tell it that too. C:\Program Files\Java\jdk-10

Finally, I need a specific version of the NDK, the one I have installed through Android studio won't cut it, Unity tells me this up front and gives me a link to the correct version. I install it and point Unity there then things start happening.

Then I get an annoying error about being unable to list build targets. After some googling, I find that Unity doesn't work with current Android Build Tools. I need v25.2.5, I grab it here: http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip, then I pop into %APP_DATA%\Local\Android\Sdk, delete tools and unzip 25.2.5 into the Sdk folder.

Now I'm getting an annoyingly cryptic gradle build error. More googling. I find out that Unity only works with JDK version 8u131 or earlier. Oracle wants me to sign away my firstborn in order to download old versions of JDK. Fortunately, PortableApps.com has it in their Sourceforge here: https://sourceforge.net/projects/portableapps/files/JDK/

After updating my JDK path under Edit->Preferences->External Tools, I'm able to build and run my scene on my phone.

Tl;dr

Unity needs some specific versions of external tools to build for Android

  1. Android build tools 25.2.5 - Delete existing <sdk-dir>\tools and unzip.
  2. JDK <= 8u131
  3. NDK r13b - If using IL2CPP scripting backend.