- Home /
Multiple errors: Gradle/SDK/JDK related. Unity android build
I'm experiencing a number of Gradle errors while trying to build an android videogame.
The original error was about the corrupted Build Tools revision 31.0.0. I followed a guide that was saying: simply uninstal api 31 in the android studio and use api 30. I did so, and now the errors are in the same number but slightly different. I've reinstalled api 31 and the error did not change back to the past group. Now i'm blocked. I don't have really nothing else to say, i'm honestly miles away from my knowledge. I can't describe what is happening.
The Errors:FIRST ERROR
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':launcher:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
SECOND ERROR
CommandInvokationFailure: Gradle build failed.
D:\Unity\Unity install\2020.3.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "D:\Unity\Unity install\2020.3.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"
stderr[
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':launcher:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Configure project :launcher
WARNING: The option 'android.enableR8' is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Build-tool 31.0.0 is missing DX at C:\Users\MyName\AppData\Local\Android\sdk\build-tools\31.0.0\dx.bat
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
File C:\Users\MyName\.android\repositories.cfg could not be loaded.
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Build-tool 31.0.0 is missing DX at C:\Users\MyName\AppData\Local\Android\sdk\build-tools\31.0.0\dx.bat
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1f5aacfb83804e518b48285b5fe58926>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1f5aacfb83804e518b48285b5fe58926>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <1f5aacfb83804e518b48285b5fe58926>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <25e9afc147634a5ca855ab83fab425dd>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
THIRD
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Configure project :launcher
WARNING: The option 'android.enableR8' is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Build-tool 31.0.0 is missing DX at C:\Users\MyName\AppData\Local\Android\sdk\build-tools\31.0.0\dx.bat
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
File C:\Users\MyName\.android\repositories.cfg could not be loaded.
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Build-tool 31.0.0 is missing DX at C:\Users\MyName\AppData\Local\Android\sdk\build-tools\31.0.0\dx.bat
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
FORTH
UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <25e9afc147634a5ca855ab83fab425dd>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <25e9afc147634a5ca855ab83fab425dd>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Answer by YasinJavaid_ · Mar 23 at 06:48 AM
Hi, I got the same error I fixed by following steps. I recommend here a few things kindly check.
(1) update build tools from SDK manager from android studio to latest current is 33.x.x
(2) then fix 32.x.x at (\SDK\build-tools) build tools by following this video.
then try to build.
if you still get errors kindly share.
Answer by XLXL99 · Aug 19, 2021 at 12:29 AM
It may have installed features that Android Build does not support on your computer. In my case, it was solved by removing Menu, Window, Package Manager, and Post Processing. You should go over Version regarding Build. Fighting.. Guy . xlxl99@naver.com From KOREA XLXL
Answer by Lozzzyy · Oct 05, 2021 at 04:21 PM
I remember having this problem and part of solving it was changing these settings (Under Project Settings -> Player -> Android Tab -> Other Settings)
Answer by vignesh211 · Nov 22, 2021 at 06:54 AM
@Nekrell I had this same errror and resolved it by doing this. 1. Paste this file (dx.bat) at SDKPath/buildtools/version/ 2. Paste this file (dx.jar) at SDKPath/buildtools/version/ and SDKPath/buildtools/version/lib/
Files:link text or just google with the file name you can get it there.
Answer by tyxkzzf123456 · Mar 23 at 03:27 AM
do you kill it; i have the same problem too then, i try to solve it follow the first answer and then the scond, but it doesnot work for me; the third answer i didnot understand; have you solve it then? i am very appreciate you can tell me
I had this error often. Try the following solutions. One of them might work for you.
Try using the latest SDK
When you look through the errors you might find it saying some files are missing in a certain location. In my case, dx.bat and dx.jar seem to missing. I just googled for the file, downloaded it, and paste it into the desired location.
Sometimes if the SDK's terms and conditions haven't been accepted while downloading it, it might cause the issue(Try redownloading it through the unity hub or search for this issue in the unity forum)
Your answer
Follow this Question
Related Questions
Android Builds ends up with error 2 Answers
4 errors after implementing unity ads in my game. 0 Answers
How can add Android 6.0 on my API Level ( I have all my sdk installed up until Android 7.0 Nougat) 1 Answer
Build Failure: Unable to list target platforms - Unity 2017.1.4p2 3 Answers
Cannot Convert Classes to dex format 2 Answers