Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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:
    93
    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,659
    That's not an error, that's only the invocation line, please attach editor.log
     
  3. rickygai

    rickygai

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

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,659
    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:
    93
    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,632
    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.