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 Compilation failed; see the compiler output for details

Discussion in 'Editor & General Support' started by glgamesforfun, Aug 23, 2021.

  1. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    Hello, I get the error "Compilation failed; see the compiler output for details. See the Console for details."
    Thanks for help! <3
    Here are the full error information:

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

    stderr[
    An exception has occurred in the compiler (1.8.0-adoptopenjdk). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
    java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)

    ...
    ...
    ...

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':unityLibrary:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.

    * 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
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[

    > Configure project :launcher
    WA<message truncated>
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    Smells like you have a broken JDK or Gradle or perhaps even the Android SDK.

    To isolate that, make an empty new Unity project and get it building for Android first. Don't try anything else until you can successfully build an empty project.

    If that does NOT build, something went wrong with your Unity installation and you must fix that first,.

    If that DOES build, then something is un-kosher in your project above.
     
  3. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    Ok, I created and built a new project and it got the exact same error.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    Excellent, safe to ignore your project and work through all the docs on setting up Unity properly to compile for Android. Always best to use the SDK, NDK, JDK and Gradle that comes with the specific version of Unity you are using.
     
  5. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    Ok, i use 2020.1.3f1
    Should I update unity too or what I have to do?
     
  6. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    I mean, should I now investigate what exactly is wrong with the error or what exactly?
     
  7. FFrench

    FFrench

    Joined:
    Feb 17, 2018
    Posts:
    2
    u should re install unity
     
  8. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    Ok, thank you!
    I installed a newer version and it works fine!
     
  9. sweway

    sweway

    Joined:
    Oct 8, 2021
    Posts:
    2
    If we install a different version of unity and work it out on an existing project, won't it misbehave? please clarify my doubt here.
     
  10. glgamesforfun

    glgamesforfun

    Joined:
    Apr 13, 2021
    Posts:
    149
    Hi,
    you should make a duplicate of your project and then fix the errors. If everything done, you can do the same thing on your main project. Hope that helps. You should install a LTS version. Works the best for me!
    :)
     
  11. GoSystems

    GoSystems

    Joined:
    Jul 5, 2022
    Posts:
    2
    i have the sane problem and i didnt find anything to past it
     
  12. florinel2102

    florinel2102

    Joined:
    May 21, 2019
    Posts:
    75
    Same problem , I fixed that by a downgrade to a lower SDK version
     
    cgkaransahu likes this.