Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug Please help Gradle build failed

Discussion in 'Android' started by candlefire, Apr 17, 2024.

  1. candlefire

    candlefire

    Joined:
    Oct 2, 2015
    Posts:
    3
    CommandInvokationFailure: Gradle build failed.
    /Applications/Unity/Hub/Editor/2022.3.9f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2022.3.9f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    Environment Variables:
    XPC_SERVICE_NAME = application.com.unity3d.unityhub.10850896.10850902
    ORIGINAL_XDG_CURRENT_DESKTOP = undefined
    XPC_FLAGS = 0x0
    JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
    PATH = /opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
    TMPDIR = /var/folders/4l/jj0_kk2s0y12qq7h1t3lc72w0000gn/T/
    SHELL = /bin/zsh
    SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.Ymrezqym7v/Listeners
    HOME = /Users/cathycheng
    __CFBundleIdentifier = com.unity3d.unityhub
    USER = cathycheng
    __CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
    LOGNAME = cathycheng
    COMMAND_MODE = unix2003
    stderr[
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':launcher:checkReleaseAarMetadata'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
    > One or more issues found when checking AAR metadata values:

    Dependency 'androidx.privacysandbox.ads:ads-adservices-java:1.0.0-beta05' requires 'compileSdkVersion' to be set to 33 or higher.
    Compilation target for module ':launcher' is 'android-32'

    Dependency 'androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05' requires 'compileSdkVersion' to be set to 33 or higher.
    Compilation target for module ':launcher' is 'android-32'

    Dependency 'androidx.core:core-ktx:1.9.0' requires 'compileSdkVersion' to be set to 33 or higher.
    Compilation target for module ':launcher' is 'android-32'

    Dependency 'androidx.core:core:1.9.0' requires 'compileSdkVersion' to be set to 33 or higher.
    Compilation target for module ':launcher' is 'android-32'

    Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires 'compileSdkVersion' to be set to 33 or higher.
    Compilation target for module ':launcher' is 'android-32'
    * 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 18s
    ]
    stdout[
    Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
    > Task :unityLibrary:FirebaseApp.androidlib:preBuild UP-TO-DATE
    > Task :unityLibrary:preBuild UP-TO-DATE
    > Task :unityLibrary:preReleaseBuild UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:preReleaseBuild UP-TO-DATE
    > Task :launcher:preBuild UP-TO-DATE
    > Task :launcher:preReleaseBuild UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:compileReleaseAidl NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:packageReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:compileReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:generateReleaseResValues UP-TO-DATE
    > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:compileReleaseAidl NO-SOURCE
    > Task :launcher:javaPreCompileRelease UP-TO-DATE
    > Task :launcher:compileReleaseAidl NO-SOURCE
    > Task :launcher:generateReleaseResValues UP-TO-DATE
    > Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
    > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:packageReleaseResources UP-TO-DATE
    > Task :launcher:extractDeepLinksRelease UP-TO-DATE
    > Task :launcher:extractProguardFiles UP-TO-DATE
    > Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
    > Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
    > Task :unityLibrary:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE
    > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
    > Task :unityLibrary:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:packageReleaseResources UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:parseReleaseLocalResources UP-TO-DATE
    > Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:processReleaseManifest UP-TO-DATE
    > Task :unityLibrary:processReleaseManifest UP-TO-DATE
    > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
    > Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
    > Task :unityLibrary:compileReleaseShaders NO-SOURCE
    > Task :unityLibrary:generateReleaseAssets UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:generateReleaseRFile UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:javaPreCompileRelease UP-TO-DATE
    > Task :unityLibrary:packageReleaseAssets UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:compileReleaseJavaWithJavac UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:bundleLibCompileToJarRelease UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseJniLibFolders UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseNativeLibs NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:stripReleaseDebugSymbols NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:extractReleaseAnnotations UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseGeneratedProguardFiles UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseConsumerProguardFiles UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseShaders UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:compileReleaseShaders NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:generateReleaseAssets UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:packageReleaseAssets UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:prepareLintJarForPublish UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:prepareReleaseArtProfile UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:processReleaseJavaRes NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:mergeReleaseJavaResource UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:syncReleaseLibJars UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:writeReleaseAarMetadata UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:bundleReleaseLocalLintAar UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:extractDeepLinksRelease UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:compileReleaseLibraryResources UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:bundleLibResRelease NO-SOURCE
    > Task :unityLibrary:FirebaseApp.androidlib:bundleLibRuntimeToJarRelease UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:createFullJarRelease UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:writeReleaseLintModelMetadata UP-TO-DATE
    > Task :unityLibrary:FirebaseApp.androidlib:copyReleaseJniLibsProjectOnly UP-TO-DATE
    > Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
    > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
    > Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
    > Task :unityLibrary:extractReleaseAnnotations UP-TO-DATE
    > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
    > Task :unityLibrary:mergeReleaseGeneratedProguardFiles UP-TO-DATE
    > Task :unityLibrary:mergeReleaseConsumerProguardFiles UP-TO-DATE
    > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
    > Task :unityLibrary:prepareReleaseArtProfile UP-TO-DATE
    > Task :unityLibrary:processReleaseJavaRes UP-TO-DATE
    > Task :unityLibrary:mergeReleaseJavaResource UP-TO-DATE
    > Task :unityLibrary:syncReleaseLibJars UP-TO-DATE
    > Task :unityLibrary:writeReleaseAarMetadata UP-TO-DATE
    > Task :unityLibrary:bundleReleaseLocalLintAar UP-TO-DATE
    > Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
    > Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
    > Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
    > Task :unityLibrary:bundleLibResRelease UP-TO-DATE
    > Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
    > Task :unityLibrary:createFullJarRelease UP-TO-DATE
    > Task :unityLibrary:writeReleaseLintModelMetadata UP-TO-DATE
    > Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
    > Task :launcher:mergeExtDexRelease UP-TO-DATE
    > Task :launcher:compileReleaseRenderscript NO-SOURCE
    > Task :launcher:generateReleaseResources UP-TO-DATE
    > Task :launcher:checkReleaseAarMetadata FAILED
    > Task :launcher:mergeReleaseResources UP-TO-DATE
    72 actionable tasks: 1 executed, 71 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <950249aad035483681d10b4c9c3c20d4>: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 <950249aad035483681d10b4c9c3c20d4>: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 <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <950249aad035483681d10b4c9c3c20d4>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,956
    It says set Target API to 33 or higher.
     
  3. candlefire

    candlefire

    Joined:
    Oct 2, 2015
    Posts:
    3
    This happend when I add firebase sdk into unity
     
  4. candlefire

    candlefire

    Joined:
    Oct 2, 2015
    Posts:
    3
    Thanks, it works
     
  5. ddooms

    ddooms

    Joined:
    Jun 10, 2015
    Posts:
    8
    I'm building to quest with this error. I can't use >32 for quest. I didn't have this error before, it randomly started showing up.
     
  6. loransalabood

    loransalabood

    Joined:
    Feb 14, 2017
    Posts:
    3
    Any solution yet?
     
  7. IGuscin

    IGuscin

    Unity Technologies

    Joined:
    May 12, 2022
    Posts:
    117
    You can try adding
    compileSdkVersion 33
    to your build.gradle template and see if that helps.