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

Question Gradle Build failing due to unsupported version of class

Discussion in 'Android' started by prateek_unity650, Oct 21, 2022.

  1. prateek_unity650

    prateek_unity650

    Joined:
    Nov 11, 2021
    Posts:
    5
    Hi,

    I'm facing an issue with the Gradle build process on Unity after adding the latest Google Mobile Ads SDK for Unity to the project. Different versions of this error have been reported before, but none of the solutions work for me (the full error message is attached):

    java.io.IOException: Can't read [C:\Users\shahp\.gradle\caches\transforms-2\files-2.1\328b84521e30516b8226e4c8a181416f\jetified-googlemobileads-unity-runtime.jar(;;;;;;;**.class)] (Can't process class [com/google/unity/ads/AdNetworkExtras.class] (Unsupported version number [55.0] (maximum 54.0, Java 10)))​

    I understand this error is because class version 55 is not compatible with Java 8 (version 52). The Mobile Ads SDK package adds a "googlemobileads-unity.aar" file to Assets\Plugins\Android which has correct class versions (51). However, at some point when Unity generates the gradle project, it downloads a separate jar file that has classes with version 55. Is there any way to stop Unity from making this replacement?

    I also tried exporting this to Android Studio, but then I get a different error - copying that here in case it provides additional information:

    Cause: com/android/tools/idea/gradle/run/OutputBuildAction has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0​

    Would appreciate any advice on how to investigate this further.
     

    Attached Files:

    Last edited: Oct 21, 2022
    Xevoss likes this.
  2. prateek_unity650

    prateek_unity650

    Joined:
    Nov 11, 2021
    Posts:
    5
    Sorry - it seems the issue is with the SDK package itself. The aar file got updated to use higher class versions - the mixup was because I was going back and forth between versions but the gradle build was not changing - have posted this as an issue on the Moble Ads SDK GitHub page.
     
  3. Xevoss

    Xevoss

    Joined:
    Jul 12, 2014
    Posts:
    5
    Hi, just got this error today and trying to solve it now
     
  4. Baydogan

    Baydogan

    Joined:
    Mar 22, 2018
    Posts:
    54