Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Error : Gradle Build Failed

Discussion in 'Android' started by Lylian16, Nov 24, 2023.

  1. Lylian16

    Lylian16

    Joined:
    Nov 19, 2023
    Posts:
    3
    Hello, I'm new on unity and I created a basic app for android phones but when I try to build the apk, it shows me an error : "Gradle Build Failed : See the Console for details" and the consol says :
    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    Environment Variables:
    PROCESSOR_ARCHITECTURE = AMD64
    JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
    AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
    DriverData = C:\Windows\System32\Drivers\DriverData
    USERDOMAIN = D16_LYLIAN
    CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
    COMPUTERNAME = D16_LYLIAN
    DEBUG_ENV_VAR = UnityHub
    LOGONSERVER = \\D16_LYLIAN
    AMPLITUDE_TOKEN_GREENBUCKET_PROD = yyzPzalJDwrQcYNuOZam0bhKb26WyyhK
    AMPLITUDE_API_KEY_YELLOWBUCKET_DEV = 48835b4d1f5e342aefe5f016324d296a
    ProgramData = C:\ProgramData
    SESSIONNAME = Console
    AMPLITUDE_TOKEN_YELLOWBUCKET_PROD = Ph-837Q6GNodAkyc2MRkxVPUcjlIET4d
    ALLUSERSPROFILE = C:\ProgramData
    SystemRoot = C:\WINDOWS
    windir = C:\WINDOWS
    AMPLITUDE_API_KEY_REDBUCKET_DEV = 46b8b46515e7632fc42a504b72e05fd0
    ProgramFiles(x86) = C:\Program Files (x86)
    ProgramW6432 = C:\Program Files
    OS = Windows_NT
    PROCESSOR_IDENTIFIER = AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
    HEAP_CLIENT_TOKEN_STAGING = 3786794399
    HOMEPATH = \Users\lylia
    FPS_BROWSER_USER_PROFILE_STRING = Default
    AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
    CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_14944_JYBOXIXXVMNMJVKZ
    PROCESSOR_LEVEL = 23
    JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
    CommonProgramFiles = C:\Program Files\Common Files
    PUBLIC = C:\Users\Public
    USERDOMAIN_ROAMINGPROFILE = D16_LYLIAN
    TEMP = C:\Users\lylia\AppData\Local\Temp
    CommonProgramW6432 = C:\Program Files\Common Files
    AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
    AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
    AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
    EFC_6936 = 1
    HOMEDRIVE = C:
    AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
    LAUNCH_DARKLY_CLIENT_TOKEN = 60a7e30fafc7e60e33446283
    USERNAME = lylia
    OneDrive = C:\Users\lylia\OneDrive
    AMPLITUDE_API_KEY_YELLOWBUCKET_PROD = e03a9bbe92dc38a88cdb068d24c65b46
    PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    AMPLITUDE_TOKEN_REDBUCKET_PROD = QqyoFpcWPi7V17p80_46CF6-sNGRGbHo
    NUMBER_OF_PROCESSORS = 12
    LAUNCH_DARKLY_CLIENT_TOKEN_STAGING = 60a7e30fafc7e60e33446282
    AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
    ProgramFiles = C:\Program Files
    ComSpec = C:\WINDOWS\system32\cmd.exe
    ORIGINAL_XDG_CURRENT_DESKTOP = undefined
    PROCESSOR_REVISION = 6001
    TMP = C:\Users\lylia\AppData\Local\Temp
    SystemDrive = C:
    AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
    JD2_HOME = C:\Users\lylia\AppData\Local\JDownloader 2.0
    FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
    OneDriveConsumer = C:\Users\lylia\OneDrive
    SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
    HEAP_CLIENT_TOKEN = 1717415662
    APPDATA = C:\Users\lylia\AppData\Roaming
    Path = C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\lylia\AppData\Local\Microsoft\WindowsApps;;C:\Users\lylia\.dotnet\tools
    PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
    LOCALAPPDATA = C:\Users\lylia\AppData\Local
    USERPROFILE = C:\Users\lylia
    WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
    stderr[
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    FAILURE: Build failed with an exception.
    * What went wrong:
    Could not determine the dependencies of task ':unityLibrary:mobilenotifications.androidlib:compileReleaseJavaWithJavac'.
    > Failed to install the following Android SDK packages as some licences have not been accepted.
    platforms;android-33 Android SDK Platform 33
    To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
    Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

    Using Android SDK: C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK
    * 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 3s
    ]
    stdout[
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-32\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
    WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
    This Android Gradle plugin (7.1.2) was tested up to compileSdk = 32
    This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
    to this project's gradle.properties
    The build will continue, but you are strongly encouraged to update your project to
    use a newer Android Gradle Plugin that has been tested with compileSdk = 33
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-32\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
    Checking the license for package Android SDK Platform 33 in C:\Program Files\Unity\Hub\Editor\2022.3.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses
    Warning: License for package Android SDK Platform 33 not accepted.
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c764018aa4484af49ae840fbd4bf43a5>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)​

    For information, I'm on the version 2022.3.13f1 of Unity.
    Can you please help me ?