Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Unity 2022.3.0f1 Android compile error - CommandInvokationFailure: Gradle build failed.

Discussion in 'Android' started by rickygai, Jun 4, 2023.

  1. rickygai

    rickygai

    Joined:
    Mar 9, 2022
    Posts:
    106
    Microsoft Windows 11 x64 Version 22H2 (OS Build 22621.1702)
    Unity 2022.3.0f1

    After migrated to Unity 2022.3.0f1, I received compile error for Android below.

    CommandInvokationFailure: Gradle build failed.
    C:\UNITY\2022.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\UNITY\2022.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

    Please advise.
     
    Shodan0101 likes this.
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    That's not an error, that's only the invocation line, please attach editor.log
     
  3. rickygai

    rickygai

    Joined:
    Mar 9, 2022
    Posts:
    106
    The editor.log is HERE.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    It says

    Code (CSharp):
    1. A problem occurred evaluating project ':launcher'.
    2. > Failed to apply plugin 'com.android.internal.application'.
    3.    > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.
    I assume you have this property in some gradle template, you might need to remove it, since I think that property was deprecated
     
  5. rickygai

    rickygai

    Joined:
    Mar 9, 2022
    Posts:
    106
    Yes, after removed the line "android.enableR8=", I am able to compile Android platform successfully. Thank you.
     
  6. scryedzxp

    scryedzxp

    Joined:
    May 14, 2013
    Posts:
    47
    I'm getting the same error but it seems to be a different issue from enableR8? Not sure how to resolve it.
     

    Attached Files:

  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    Looks like you are building using SDK lower than 33.
    Notifications package requires 33.
    Unity by default sets compile sdk to the same as target sdk, so you need to either set target sdk to 33, or modify gradle file and set compile sdk to 33.
    Note, that Google will soon require all apps and updates to target sdk 33.
     
    CareyMcDuff and Shodan0101 like this.
  8. scryedzxp

    scryedzxp

    Joined:
    May 14, 2013
    Posts:
    47
    Thank you. That resolved the issue.
     
  9. brainofgames

    brainofgames

    Joined:
    Jan 17, 2023
    Posts:
    1
    I'm facing same issue. I see this error:

    Execution failed for task ':launcher:checkReleaseDuplicateClasses'.


    I'm trying for last 2 days to update to different SDKs and tried several forum suggestions.

    Can anyone throw some light?

    Attached full copy of error text here
     

    Attached Files:

    anycolourulike likes this.
  10. umarhayat

    umarhayat

    Joined:
    Feb 2, 2017
    Posts:
    1
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
    > Duplicate class _COROUTINE.ArtificialStackFrames found in modules jetified-kotlinx-coroutines-core-jvm-1.7.1 (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.1) and jetified-org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm-1.7.1 (org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm-1.7.1.jar)
    Duplicate class _COROUTINE.CoroutineDebuggingKt found in modules jetified-kotlinx-coroutines-core-jvm-1.7.1 (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.1) and jetified-org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm-1.7.1
     
  11. HamzaMubeenSE

    HamzaMubeenSE

    Joined:
    Nov 7, 2023
    Posts:
    2
    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Java\jdk-11\bin\java.exe -classpath "D:\Asset\SDKs\gradle-6.1.1\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
     
  12. unity_7BD88DB5C704034C93C0

    unity_7BD88DB5C704034C93C0

    Joined:
    Jan 9, 2024
    Posts:
    9
    Same error Not Build Apk
     
  13. unity_7BD88DB5C704034C93C0

    unity_7BD88DB5C704034C93C0

    Joined:
    Jan 9, 2024
    Posts:
    9
    FAILURE: Build failed with an exception.

    * Where:
    Build file 'C:\Users\DREAMWORLD\Downloads\Cannon Shooter\Cannon Shooter\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Failed to apply plugin 'com.android.internal.application'.
    > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.

    * 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 2s

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Unity\Hub\Editor\2023.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2023.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    Environment Variables:
    PROCESSOR_ARCHITECTURE = AMD64
    JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2023.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
    AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
    DriverData = C:\Windows\System32\Drivers\DriverData
    USERDOMAIN = DESKTOP-M5D061O
    CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
    COMPUTERNAME = DESKTOP-M5D061O
    DEBUG_ENV_VAR = UnityHub
    LOGONSERVER = \\DESKTOP-M5D061O
    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 = Intel64 Family 6 Model 167 Stepping 1, GenuineIntel
    HEAP_CLIENT_TOKEN_STAGING = 3786794399
    HOMEPATH = \Users\DREAMWORLD
    FPS_BROWSER_USER_PROFILE_STRING = Default
    AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
    CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_9920_INMWBIRCLZHWMVJA
    PROCESSOR_LEVEL = 6
    EFC_6396 = 1
    CommonProgramFiles = C:\Program Files\Common Files
    PUBLIC = C:\Users\Public
    USERDOMAIN_ROAMINGPROFILE = DESKTOP-M5D061O
    TEMP = C:\Users\DREAMW~1\AppData\Local\Temp
    ProgramFiles = C:\Program Files
    CommonProgramW6432 = C:\Program Files\Common Files
    AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
    AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
    AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
    HOMEDRIVE = C:
    AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
    USERNAME = DREAMWORLD
    OneDrive = C:\Users\DREAMWORLD\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
    GTK_BASEPATH = C:\Program Files (x86)\GtkSharp\2.12\
    AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
    AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_DEV = client-wbjHYrmeSR87GmWOE7LDpf7sUySOIKHm
    ComSpec = C:\WINDOWS\system32\cmd.exe
    ORIGINAL_XDG_CURRENT_DESKTOP = undefined
    PROCESSOR_REVISION = a701
    AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_PROD = client-zH8Y7OK1i331EKuG77C6UxN8ygcM6LzS
    TMP = C:\Users\DREAMW~1\AppData\Local\Temp
    SystemDrive = C:
    AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
    FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
    SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
    HEAP_CLIENT_TOKEN = 1717415662
    APPDATA = C:\Users\DREAMWORLD\AppData\Roaming
    Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Java\jdk-11\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Users\DREAMWORLD\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\DREAMWORLD\AppData\Local\Programs\Python\Python312\;C:\Users\DREAMWORLD\AppData\Local\Programs\Python\Launcher\;C:\Users\DREAMWORLD\AppData\Local\Microsoft\WindowsApps;C:\Users\DREAMWORLD\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Java\jdk-11\bin;C:\Users\DREAMWORLD\AppData\Local\GitHubDesktop\bin
    PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Intel\Wired Networking\
    LOCALAPPDATA = C:\Users\DREAMWORLD\AppData\Local
    USERPROFILE = C:\Users\DREAMWORLD
    WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3


    stderr[

    FAILURE: Build failed with an exception.

    * Where:
    Build file 'C:\Users\DREAMWORLD\Downloads\Cannon Shooter\Cannon Shooter\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Failed to apply plugin 'com.android.internal.application'.
    > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.

    * 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 2s
    ]
    stdout[

    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <b7e96724fd144722bd22a7656698b4f8>: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 <b7e96724fd144722bd22a7656698b4f8>: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 <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <b7e96724fd144722bd22a7656698b4f8>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    Build completed with a result of 'Failed' in 525 seconds (524808 ms)
    2 errors
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     
  14. IGuscin

    IGuscin

    Unity Technologies

    Joined:
    May 12, 2022
    Posts:
    60
    Check your gradle.properties file. Seems that incorrect value is set for android.enableR8 property