Build failed with errors. at UnityEditor.BuildPlayer+Default buildMethods how to resolve it ?

I am following Building Unity game for an Android device for the testing tutorial I have followed all the instruction but I am getting this error in the end. from this link

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()

As you have noticed after you click build settings you are prompt to download it in the asset, which unity wouldn’t allow to build exe files inside asset. in that case, try building it in a different folder or in desktop. It works fine for me! :smiley:

Try using the build option ( not build & run )

  • ( it worked for me )

when I had this error and “CommandInvokationFailure”, I went to the peferences and changed my jdk to 1.8 from 1.7, It worked.

Got same problem. This is how I solved it:
1.In “tools” directory of android SDK open a file named ‘android’ and in the list choose all 25-versions - install those packages (Note: this file didn’t want to open while my SDK was installed in C-System, so I was supposed to copy whole SDK in another one and it finaly launched );
2. Install JDK-8, not 9! Even if you have 9-version, download 8 and in Unity in Edit->Preferenses change jdk path to 8-version.
After this two steps I finaly resolved my problem. Good luck, hope it will help someone :slight_smile:

I have the same error, I installed Unity 2017.1 and configured Android. I have a simple project, but when I build for android I get this error: “UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.”

If you track the error that bring you to UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent deprecated method.

comment out it then try.
hope this will helpful.

Try to install the latest version of build tools, that fixed the problem for me.

Hi
It helped me !!!
Build System change to Gradle

Close and Re-open Unity Editor

So this is a generic “something went wrong” message. There should be another message before it saying what caused the problem.
Hence the reason all the answers here being for different problems.

The trouble is that the actual error messages do not always show in the Editor.
Save/Re-Open etc… sometimes shows you the real error message. A Re-Import all often works if you have a couple hours to kill.
But, you can often find the actual error message in the
Editor LogFIle. It takes a lot of searching through, but it is normally in there somewhere.
Why they don’t make it through to the editor i’m not sure, but it is definitely worth a look.

Here’s something that worked for me…
Tested on Unity 2019.2.9f1
Notice that you should have the latest sdk + jdk8

1.Close Unity
2.Delete the “.gradle” folder in: "C > User > username > "
3.Connect to the internet with a stable connection
(because unity’s gonna download the required files itself during the build)
4.Now open up your project and just Build with the default build settings

Building the Gradle file will take some time for the first time and it may look freezed around 30Mins or more… but just let the unity do the job.
Download’s gonna be near 250MB

restart unity that worked for me

I had selected “strip assemblies” in player settings and I was getting this error and APK was not building. But when I disabled stripping The APK is building but still getting this error message in console. anyone knows why?

EDIT: I was making for Android. After updating Android SDK I didn’t get any error. So if you are making for android make sure Android SDK and JDK are updated.

Got the same issue. I “Fixed it” by building in a pro version.

Please let me know if you solve this in personnal mode!

I had the same error and I avoided it generating all lightmaps again (of each scene). I don’t know if this is the certain solution, but you can try it and see.

Had crash when building windows executable.

Fixed it by changing build architecture to x86_64 in build settings

I fixed my error by re-saving all scenes and the project before building, even though there was nothing new to save.

I just clicked on “Reimport all assets”. Then everything was fine.

I see your error is saying (Boolean askForBuildLocation, BuildOptions defaultBuildOptions).

Try building the app on some other location on your drive. Worked for me.