Gradle build failed is not the error
Originally published on indiecore.net . I made a throwaway Unity 6000.4.0f1 project on a Mac, built a release APK from it, and then broke it four different ways to see what the console would say. The APK took 155 seconds in the Gradle stage and came out at 27 MB. Every failure below is from a log on this laptop, not from a thread I read. The reason for doing it that way: the message everybody…
The title of the story is "Gradle build failed is not the error." The author explains that they created a throwaway Unity project on a Mac, built a release APK, and then intentionally broke the build in four different ways to observe the console output. They noticed that the error message, "CommandInvokationFailure: Gradle build failed," did not provide any insight into the actual cause of the failure.
The author found that the relevant error message, "What went wrong: Duplicate class com.unity3d.player.UnityPlayer found in modules unity-classes-copy.jar (unity-classes-copy.jar) and unity-classes.jar ...," was much further down in the log file, 235 lines before the initial error line. They advise readers to look for this line instead of searching for the error message.
The author also mentions two other observations from the log: a CommandInvokationFailure unrelated to the build process and an issue with a JitPack repository not being recognized by Unity. They conclude by instructing readers to search the log file using the command "grep -A6 ^* What went wrong: ..." to find the real cause of the build failure.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.