UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
UnityEditor.HostView:OnGUI()
The problem for me was the SDK file (I had the same .cs 162 & .cs 83 errors)
First: In Unity : Edit > Preferences > External Tools and click Download.
It should take you to:
Second: Download Android Studio NOT just the Sdk at the bottom
Third: After Download go back into unity and click File > Build Settings >
Player Settings > ‘Other Settings’ (in inspector) and set the ‘Minimal API level’
to the highest setting ‘Android 7.1’Nougat’ (API level 25)’ and click ‘Build & Run’ (Not just ‘Build’)
This build will fail, but the fail pop up box will inform you what your devices API level is.(Mine is 23)
Put ‘Minimal API level’ back to the original setting (Min api level) after you’ve learned your API level.
Fourth: Start ‘Android Studio’ and on the bottom right of the main screen click ‘Configure’ >
‘SDK Manager’ > ‘Appearance & Behavior’ tab > ‘System Settings’ tab click ‘Android SDK’
Fifth: Now just Check the box with the ‘API level’ your device is at and click apply to download. (Remember file path)
Sixth: Once the download is complete go back into Unity: Edit > Preferences > External Tools
Beside SDK click browse and link it to the SDK folder of your API level download.
(Example: C:\Users\Anthony\AppData\Local\Android\sdk)
I had the same problem when I tried to build an app. I was using unity 2017.2.1f1
I solved the problem by changing the tools in the sdk folder with the tools_r25.2.5 - Download this file online here - Android SDK Offline: Android SDK Tools/Manager
First just rename the tools folder already present in sdk root folder with toolsXXXX and then
Unzip tools_r25.2.5 and copy its tools into the sdk root folder.
===============================================================================================================================================
still the error was there then I realised that the jdk version is not correct too. so download jd1.8 here - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
download java kit 8u161 and then in Edit->Preferences ->External Tools
Set these jdk1.8 path and sdk path
It worked for me after that and I built my first app using Unity 3d
I hope it works for you too.
I used task manager and closed Unity and then redownloaded the same version of unity. During the redownload, the unity installer gets rid of your previous unity installation and downloads the new one. This worked for me to get rid of that error.