Khamidjon Khamidov
Khamidjon Khamidov

Reputation: 8999

BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61 on Apple Arm

I have installed Android Studio Canary 2020.3.1.22 and trying to run Flutter project on Apple Silicon(ARM) Mac. Unfortunately, it is giving me this error when I try to run default flutter counter app.

Here is the error I am getting:

Could not open settings generic class cache for settings file '/Users/khamidjonkhamidov/StudioProjects/dummy/android/settings.gradle' (/Users/khamidjonkhamidov/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

Gradle version: 6.7 but I tried 7+ JDK version 17

I would really appreciate your help)

Upvotes: 249

Views: 497858

Answers (30)

siddhant saraf
siddhant saraf

Reputation: 11

this generally happens after updating the android studio and/or updating java on your system , i have updated the android studio and java as well , studio to

Android Studio Ladybug | 2024.2.1 Patch 2 Build #AI-242.23339.11.2421.12550806, built on October 24, 2024 Runtime version: 21.0.3+-12282718-b509.11 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.awt.windows.WToolkit Windows 11.0

and java to jdk-23.

and got this error while building.

solution

change the jdk use by your flutter by executing

flutter config --jdk-dir 'path-to-your-jdk-of-choice'

the 'path to your choice is the path to the folder where jdk is located normally "C:\Program Files\Java\jdk-19" like this , in my case i needed to use gradle dist distributionUrl=https://services.gradle.org/distributions/gradle-7.6.3-all.zip

which is compatible with jdk 19, you can find the compatible vesrion and the matrix here

Upvotes: 1

Akash kumar
Akash kumar

Reputation: 1053

For Mac -:

Increase Gradle Version and AGP

File -> Project Structure -> Project -> Increase Gradle Version and Android Gradle Plugin Version

AGP

Set Gradle JDK -:

Android Studio -> Preference -> Build Execution Deployment -> Build Tools -> Gradle -> Gradle JDK

In Build.gradle Andrdoid Section use the latest JDK version you have configured above.

 compileOptions {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_21
            targetCompatibility JavaVersion.VERSION_21
        }
    }

Enjoye!!

Upvotes: 2

calraiden
calraiden

Reputation: 1828

I recently updated my Android Studio and Flutter, and I started experiencing the same issue.

flutter run
Launching lib\main.dart on SM F415F in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Could not open cp_settings generic class cache for settings file 'PROJECT\android\settings.gradle' (C:\Users\Claudio\.gradle\caches\7.6.3\scripts\gmzea7a38jwwtj6757fg97wu).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

* 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 997ms
Running Gradle task 'assembleDebug'...                           1.739ms

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle.                                                                                                                                                         │
│                                                                                                                                                                                                                                                                   │
│ If you recently upgraded Android Studio, consult the migration guide at https://flutter.dev/to/to/java-gradle-incompatibility.                                                                                                                                    │
│                                                                                                                                                                                                                                                                   │
│ Otherwise, to fix this issue, first, check the Java version used by Flutter by running `flutter doctor --verbose`.                                                                                                                                                │
│                                                                                                                                                                                                                                                                   │
│ Then, update the Gradle version specified in PROJECT\android\gradle\wrapper\gradle-wrapper.properties to be compatible with that Java version. See the link below for more information on compatible Java/Gradle versions: │
│ https://docs.gradle.org/current/userguide/compatibility.html#java                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                   │
│                                                                                                                                                                                                                                                                   │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1

Apparently, even though I had JAVA_HOME configured in the environment variables, Android Studio was running its own Java, installed on another path.

$ java --version
java 17.0.12 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)

$ flutter doctor --verbose
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [versÆo 10.0.19045.5011], locale pt-BR)
    • Flutter version 3.24.3 on channel stable at C:\Workspace\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Workspace\android\android-sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\Workspace\android\android-sdk
    • Java binary at: C:\Users\Claudio\AppData\Local\Programs\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Users\Claudio\AppData\Local\Programs\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] Connected device (4 available)
    • SM F415F (mobile) • RQ8R503THDB • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [versÆo 10.0.19045.5011]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 130.0.6723.59
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 130.0.2849.46

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

JAVA_HOME is set to "C:\Program Files\Java\jdk-17," and Flutter doctor displays "• Java binary at: C:\Users\Claudio\AppData\Local\Programs\Android Studio\jbr\bin\java."

The solution was to manually configure the JDK for Flutter:

$ flutter config --jdk-dir="C:\Program Files\Java\jdk-17"
Setting "jdk-dir" value to "C:\Program Files\Java\jdk-17".

Only then did the problem stop.

$ flutter doctor --verbose
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [versÆo 10.0.19045.5011], locale pt-BR)
    • Flutter version 3.24.3 on channel stable at C:\Workspace\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Workspace\android\android-sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\Workspace\android\android-sdk
    • Java binary at: C:\Program Files\Java\jdk-17\bin\java
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Users\Claudio\AppData\Local\Programs\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] Connected device (4 available)
    • SM F415F (mobile) • RQ8R503THDB • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [versÆo 10.0.19045.5011]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 130.0.6723.59
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 130.0.2849.46

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Upvotes: 1

Finding Nemo
Finding Nemo

Reputation: 21

I fixed by checking the java version in the android studio settings. I've updated the android studio to the latest version and It got updated the java version by default it self. All we need to is change the java version to the older version like which version is used to run the app. by changing the gradle jdk version the issues is fixed.

Tada the bug is fixed!

Upvotes: 0

Alex.F
Alex.F

Reputation: 6201

tl;dr

If you have upgraded Android studio (or changed Android's Gradle version or AGP Android Gradle Plugin version) and now you're flutter project won't build, it might be due to incompatible java and gradle versions.

To override the java version which flutter uses by default call:
flutter config --jdk-dir 'path-to-your-jdk-of-choice'
For example: flutter config --jdk-dir '/Users/some-user/Library/Java/JavaVirtualMachines/corretto-17.0.12/Contents/Home'

How to check which java version your flutter uses right now?

call flutter doctor -v and look for Android toolchain section. It will look something like this:

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/my-username/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Users/my-username/Library/Java/JavaVirtualMachines/corretto-17.0.12/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Corretto-17.0.12.7.1 (build 17.0.12+7-LTS)
    • All Android licenses accepted.

Flutter will use the java version where it says Java binary at:. If this is not the version you need flutter to use read on.

How to check which Gradle version is defined for the project

Go to android - gradle - wrapper - gradle-wrapper.properties and look for some like 'distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip` This is your gradle version (7.5 in the example)

How to check if the Gradle version is compatible with the java version

Go to https://docs.gradle.org/current/userguide/compatibility.html#java and look at the table

How flutter selects the java version to use

Changing the gradle jdk as described above does not affect which java jdk version flutter uses when you run the flutter project or when you run using flutter run command.
This is because Flutter will run using the android studio built-in jdk if that is available. See the official documentation here, where it states:

The Android Studio app includes a version of Java, which Flutter uses by default.

How to find the paths for already installed java version

call /usr/libexec/java_home -V The output will be something like:

Matching Java Virtual Machines (4):
    17.0.12 (arm64) "Amazon.com Inc." - "Amazon Corretto 17" /Users/me/Library/Java/JavaVirtualMachines/corretto-17.0.12/Contents/Home
    15.0.10 (arm64) "Azul Systems, Inc." - "Zulu 15.46.17" /Users/me/Library/Java/JavaVirtualMachines/azul-15.0.10/Contents/Home
    1.8.421.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_412 (arm64) "Amazon" - "Amazon Corretto 8" /Users/me/Library/Java/JavaVirtualMachines/corretto-1.8.0_412/Contents/Home

Overriding the default jdk dir flutter uses

A change was made to flutter that allows setting the java version to be used when running or building a Flutter project (using flutter run or from within a Flutter project). The pull request describing the change: https://github.com/flutter/flutter/pull/128264
This allows calling flutter config --jdk-dir to set the jdk directory for Flutter to use.

note: all commands are intended for linux/mac

Upvotes: 1

Faiz
Faiz

Reputation: 6960

I faced the same error when I updated my android studio

Solution:

you need to upgrade the distributionUrl field in your in gradle/wrapper/gradle-wrapper.properties file according to the java version

‌Below is the Java version and Supported Gradle version

more updates

Upvotes: 92

Jp Silver
Jp Silver

Reputation: 164

A easy solution i found to this is just to modify the gradle.properties file and add:

org.gradle.java.home=<your path to a older jdk>

to your gradle.properties file if you have other projects relying on a newer jdk version.

Upvotes: 2

Vishnu TejaReddy
Vishnu TejaReddy

Reputation: 21

hey guys i also encountered this issue while cloning my android project worked on windows to macbook I simply downloaded the zip file and imported the project and initialised git in it. note:for safeside it is better to use different branch (i used branc

Upvotes: 0

Vinay Kumar Shukla
Vinay Kumar Shukla

Reputation: 21

I was using QtCreator 13, and got this error while doing deploy to my android device. I was using jdk 21, and resolved this by setting gradle in build.gradle to

dependencies {
    classpath 'com.android.tools.build:gradle:8.5.0'
}

and inside gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

Upvotes: 2

Dolphin
Dolphin

Reputation: 38985

I am facing the same issue when ugprade the jdk version to 21. Upgrade the gradle version to 8.4 fixed this issue.

Upvotes: 0

S K
S K

Reputation: 381

There is no need to downgrade Java version. Just upgrade Gradle

  1. Select the gradle version which supports your Java version link
  2. Open your project and navigate to your_project_name/android/gradle/wrapper/gradle-wrapper.properties
  3. Change distributionUrl Gradle version according to your Java version. You can see the list here: gradle list

Upvotes: 38

Nirbhay Rana
Nirbhay Rana

Reputation: 4357

You need to change the gradle version at Two places:

 1. android>gradle>wrapper - change the distribution url
 2. android> build.gradle  under dependencies change gradle version

Gradle veriosn should be compatible with install java. You can check from here. https://docs.gradle.org/current/userguide/compatibility.html

Upvotes: 0

neberaa
neberaa

Reputation: 2442

According to the official grade docs: Java 17 and later versions are not yet supported.

You can check compatibility here.

So I have installed Java11 from Azul.

p.s. don't forget to change jdk version in Android studio which is available only on the Android project, to open it

File-> open -> select the android folder inside your flutter project -> open in a new window

Then you can change jdk version Preferences -> Build -> Build Tools -> Gradle -> Gradle JDK

Upvotes: 206

Duna
Duna

Reputation: 1612

I resolved the issue by triggering the Gradle task in Android Studio's context menu using my mouse. Attempting to execute it through the command line resulted in the error mentioned in the title of this question.

Also I deleted .gradle folders from /users/account/.gradle and project/.gradle

Upvotes: 0

Royal Prince
Royal Prince

Reputation: 11

Upgrade your distribuiton url in app\android\gradle\wrapper\gradle-wrapper.properties to the latest version with this link , distributionUrl=https://services.gradle.org/distributions/gradle-{latest version}-all.zip.

Upvotes: 1

Blundering Philosopher
Blundering Philosopher

Reputation: 6805

FYI I was seeing this b/c in Egypt, ISPs often block jsdelivr :(

Here's a related issue: https://github.com/CocoaPods/CocoaPods/issues/11939#issuecomment-1582406310

So I installed & ran Nord VPN, re-ran pod install, good to go

Upvotes: 1

Lins Louis
Lins Louis

Reputation: 2643

I was trying to clone a Flutter project from GitHub that was working perfectly until the last commit and push. After deleting it locally and cloning it again, I encountered an error when opening it in Android Studio.

Solution:

Open the Android module of the Flutter project in Android Studio.

Set the Gradle JDK to zulu-17 by going to Settings > Build, Execution, Deployment > Gradle. In my case, the Gradle Plugin Version was 7.2.01, which can be found in File > Project Structure > Project. Check the Gradle documentation to find the compatible JDK versions for your Gradle version. https://docs.gradle.org/current/userguide/compatibility.html

Run java -version in the Flutter project's terminal window. In my case, it showed a different Java version than zulu-17.

Set the JDK path in the .zshrc file located at /Users/homepathname/.zshrc:

export JAVA_HOME="/Users/homepathname/Library/Java/JavaVirtualMachines/azul-17.0.7/Contents/Home"
export PATH=$JAVA_HOME/bin:$PATH

Open a new terminal window in the Flutter project and run java -version again. This should show the same Java version as the Gradle JDK.

The project should now run without any problems.

This solution worked for me as it synchronized the Java versions used by Gradle and the terminal.

Upvotes: 1

M. Massula
M. Massula

Reputation: 4820

In my case I had this set

Typing flutter --version on terminal:

Flutter 3.7.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c07f788888 (10 weeks ago) • 2023-02-22 17:52:33 -0600
Engine • revision 0f359063c4
Tools • Dart 2.19.2 • DevTools 2.20.1

Typing javac -version on terminal to get you java version:

javac 19.0.2

So, by this grade compatibility matrix I had to update my project/android/gradle/wrapper/gradle-wrapper.properties distributionUrl to:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

Upvotes: 12

Bashid
Bashid

Reputation: 520

Usually, this bug relates to the incompatibility of the gradle version and the JDK version.

if you want to be sure. first check this for compatibility.

if this is your problem. find your version in this, then rename your version in gradle-wrapper.properties of your project.

Upvotes: 1

Abdallah Mahmoud
Abdallah Mahmoud

Reputation: 937

Error

Could not open settings generic class cache for settings file '/Users/khamidjonkhamidov/StudioProjects/dummy/android/settings.gradle' (/Users/khamidjonkhamidov/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64

Steps To Solve :

1- open the gradle prodperties see the current project gradle example "gradle-7.4"

2- open compatibility see https://docs.gradle.org/current/userguide/compatibility.html

3- download java version, in ower example java 17 https://www.oracle.com/java/technologies/downloads/

Upvotes: 3

Elmar
Elmar

Reputation: 4445

Happened with newly created Flutter app in 2023 January with Mac Mini M1. If you have another working Flutter apps do not downgrade or update Java version as it will cause problem with all other working ones. Find gradle-wrapper.properities file inside gradle/wrapper folder (directly inside Android folder) and check gradle version. You just need to use newer version of gradle. I replaced this one and used flutter run command from terminal and it worked:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

With this one:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

No need to do anything else. Version number may be different for you depending on when you are trying this and what Java version you have.

Note: Same fix also effective for another error message as well stating version 63:

BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

Upvotes: 25

Sumit Ojha
Sumit Ojha

Reputation: 444

This problem can be solve by cleaning and upgrading the flutter project use these command on your terminal

--> flutter clean then run --> flutter upgrade

Upvotes: 1

Mahm00d
Mahm00d

Reputation: 3921

System: Mac M1, Android Studio Electric Eel (2022.1.1 Patch 1), JDK 19.02

I encountered this error when created a fresh project using flutter create and tried to run it in Android Studio.

Now I've got an interesting solution that worked for me:

  1. Open the flutter project in Android Studio
  2. Open build.gradle, the one under android folder
  3. On the top right it shows "Open for Editing in Android Studio" (although it's already in Android Studio!). Click on that to open it for editing. I opened it in another window, but doesn't matter.
  4. It starts to automatically download and update gradle to sync the build file. At one point, tt might also prompt you to upgrade gradle, which is good to do.
  5. Done! Close the build.gradle and re-run the project. It should build and run fine.

Upvotes: 2

Tomas Zubrik
Tomas Zubrik

Reputation: 497

Context: Flutter, Mac M1, Java 19.0.2

Problem occured on following command:

flutter build apk

I just installed (reintalled) gradle via homebrew like this:

brew install gradle

I suppose it was related to my recent upgrade (Java was upgraded to OpenJDK Temurin 19.0.2).

I also noticed that flutter command was trying to use gradle 7.4 (the only one gradle version installed before). As previously mentioned by others, there has to be consistency between your Java version and gradle version according to Gradle Official Compatibility Matrix.

Please, verify it with following commands:

java -version
gradle -version

I think this process / solution can be applicable in general. Hope it helps!

Upvotes: 1

Ayoub Ali
Ayoub Ali

Reputation: 87

Windows Users

Open Android Studio and Click on Setting ICON far right. And Go to Project Structure Option and select the SDK's Version 11.0.15 and click apply than on the left side click on Module Option and select Module SDK's options and select Project SDK 11. and at the bottom at Project Settings CLICK on SDK and select on 11 SDK versions. It will give you the JDK path

C:\Program Files\Android\Android Studio\jbr

Copy this path and Open the System Environment Variable Create a New JAVA_HOME path with the location Image

and click OK and save everything Now run your app in ANDROID STUDIO and ENJOY!

Upvotes: 3

college students
college students

Reputation: 1

In my case, I use the react native cli and my android gradle is 7.3.1. I open the android folder in the android folder in the android studio and it suggests my gradle once after degradation it works fine

Upvotes: 0

Elmar
Elmar

Reputation: 4445

Easy fix in 2023:

  1. Command in the terminal:

    export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

  2. Check classpath, current working one:

    classpath 'com.android.tools.build:gradle:7.1.2'

  3. Check gradle-wrapper.properities file:

     distributionBase=GRADLE_USER_HOME
     distributionPath=wrapper/dists
     zipStoreBase=GRADLE_USER_HOME
     zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
    
  4. If still not solved you need to change Gradle JDK from inside Android Studio like below.

enter image description here

After that you can run fluter app directly from terminal without any issue. Note: Android Studio default JDK (11.0.15) does not work and causes this issue. Azul Zulu 16.0.2 works and solves the issue.

Upvotes: 1

vinay shetty
vinay shetty

Reputation: 981

Changing the Java Version in the Intellij resolved the issue. enter image description here

Upvotes: 0

Lucian Thorr
Lucian Thorr

Reputation: 2267

I ran into this issue on VSCode+Mac using the Gradle for Java extension.

My project uses Java 17 but Gradle was using JDK19, which I also had installed. I removed the jdk-19.jdk folder from /Library/Java/JavaVirtualMachines and then ran the "Clean Java Language Server Workspace" task in VSCode.

After that, Gradle successfully built and I was even able to put the jdk-19 folder back and things continued to work.

Upvotes: 0

Matheus Lima
Matheus Lima

Reputation: 11

Giving my two seconds here... In my case, I could fix it by finding my gradle version in the file gradle.wrapper.properties and checking the compatibility with the JDK, so I needed to install the JDK 16, so in my build.gradle(:app) I put this line of code inside the android {} :

compileOptions {
   sourceCompatibility JavaVersion.VERSION_16
   targetCompatibility JavaVersion.VERSION_16
}

After this I build my android version again, and it worked.

Upvotes: 0

Related Questions