Cannot connect Unity 5.3.4f1 to Android SDK

I’m trying to install Unity for development on Android, but can’t get Unity to work with the Android SDK/Android Studio. When I try to “build” a simple Android app, I get the errors below.

For clarity:

-I have built an app in Android Studio and run it using the debugging features on a Samsung Galaxy S6.
-I have built and run my Unity3D app as a Windows 10 exe.
-I’ve also tried with a Unity2D app (using an Android build), still doesn’t work.
-My ultimate goal here is Oculus/GearVR development, but I’ve run tests from scratch for just a simple plain app.
-My installed Android packages are in the attached screen shot.

Please help. I’ve been trying to resolve this for nearly a month & am aware of at least one other user in this forum who is having the same problem. Horribly frustrating.

I have also set the following values/parameters:

In Unity:

Edit | Preferences | Externals Tools | Android | SDK = “C:/Users/Ian/AppData/Local/Android/sdk” (Not sure why it inverts the slashes)

Edit | Preferences | Externals Tools | Android | JDK = "C:\Program Files\Java\jdk1.8.0_77" (slashes appear normally in Windows form)

System variables:

JAVA_HOME = “C:\Program Files\Java\jdk1.8.0_77”

PATH = “C:\Program Files\Java\jdk1.8.0_77\bin; C:\Users\Ian\AppData\Local\Android\sdk; C:\Users\Ian\AppData\Local\Android\sdk\platform-tools; C:\Users\Ian\AppData\Local\Android\sdk\tools”

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Ian\AppData\Local\Android\sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/Users/Ian/AppData/Local/Android/sdk\platforms\android-23\android.jar” -F bin/resources.ap_ --extra-packages com.oculus.Integration -S “C:\Users\Ian\Documents\Development\Cubetacular\Temp\StagingArea\android-libraries\ovrplugin\res”

stderr[

]
stdout[

]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[ ] progress_strings, Single progress_value, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.HostView:OnGUI()

Are you using Google Play Services or any other Google services such as Admob? I had similar errors when using them.

The Google Play Services package isn’t installed in Android Studio/the SDK manager. Not using any third party plugins or libraries. Just a dead simple app - a plane and a cube, just sitting there.

Have you found any solution? If not try this,

Android SDK Manager > Tools (Preview Channel) > Delete (24rc2, 24rc3) packages. And try building it. It will work.

Huzzah! This worked!

Thanks so much, appslabs.