Building an APK error: CommandInvokationFailure: Failed to re-package resources. See the Console for details.

I am having problems building an APK. I have followed all the steps to set up unity to build an ADK. All the relevant SDK and JDKs are installed etc. Error:

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
U:\Android\android-sdk\build-tools\24.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “U:/Android/android-sdk\platforms\android-24\android.jar” -F bin/resources.ap_ --extra-packages com.oculus.Integration -S “U:\Projects\Test2\New Unity Project\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()

Unity is running aapt.exe from build-tools/24.0.0 ( you can see the path of aapt.exe in the log).
Version 24 is for Android N (the next upcoming version Android), which is not supported by Unity at the moment ( i saw this complaint from other people recently).

Under your Android SDK folder, you should remove the 24.0.0 folder, or, in case you need that version specifically, you should upgrade to the latest Unity version (5.3.5 patch 4 i think) which may support this, but i’m not sure …

NOTE: In some cases, it can get a bit tricky to find out why the build fails. If all else fails, I offer a service on Fiverr to help fix Android related build issues (due to manifest merging, conflicting plugins, etc). Check it out if you’re unable to resolve your issues !