How to set compileJava' task ( 11) and 'compileKotlin' task (1.8) jvm target compatibility to the same Java version in build.gradle.kts?
Asked Answered
T

26

295

Build.gradle.kts

buildscript {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath ("com.android.tools.build:gradle:7.0.2")
        classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
        classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${Versions.spotbugsGradlePluginVersion}")
        classpath("se.bjurr.violations:violations-gradle-plugin:${Versions.violationsVersion}")

    }
}
//android {
//    compileOptions {
//        sourceCompatibility = JavaVersion.VERSION_11
//                targetCompatibility = JavaVersion.VERSION_11
//    }
//
//    kotlinOptions {
//        jvmTarget = JavaVersion.VERSION_11.toString()
//    }
//}
plugins {
    `maven-publish`
    `java-gradle-plugin`
    `kotlin-dsl`
    id ("io.gitlab.arturbosch.detekt") version ("1.18.1")
}
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}

dependencies {
    compileOnly(gradleApi())
    testImplementation(gradleTestKit())
    testImplementation("junit:junit:${Versions.jUnitVersion}")
}
val generatedSources = tasks.register<GenerateVersionsFileTask>("generateSources")

I get the following error:

ERROR : 'compileJava' task (current target is 11) and 'compileKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.

When I uncomment android {}, I get:

Error : Script compilation errors:

 Line 15: android {
           ^ Unresolved reference: android
Tannenwald answered 6/9, 2021 at 20:25 Comment(2)
Note that if you don't have any Java sources (only Kotlin sources) this message actually should not appear at all, also see youtrack.jetbrains.com/issue/KT-48745.Nganngc
I believe that the "android" block not resolving is because you don't have either "com.android.application" or "com.android.library" plugin appliedMorphophonemics
T
258

We also need to pay attention to the version that the error is showing. In my case it was :

Caused by: org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

Which means,the Android Studio IDE is using 17 (You can find it in File Menu->Project Structure->SDK Location->JDK location)

And You are using 1.8 in your gradle files.

So you need to change

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

and

kotlinOptions {
    jvmTarget = '1.8'
}

to

compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
}

and

kotlinOptions {
    jvmTarget = '17'
}

Note that

since the error showed 17, I have also switched to 17.

This happened when I upgraded gradle to 8.0.

Beware of release issues. Kindly take a backup before doing the procedure. May face issues in release aab.

Make sure to check the release apk after this procedure is done, because R8 expects things like this

Tautonym answered 20/4, 2023 at 5:19 Comment(3)
Facing exact issue did all you mentioned here, but still no lock. Were you able to fix this?Figurine
@MohammedYakubM. maybe you can try to change the android studio settings to match the old gradle. Hope you are using the latest version of Android Studio. I checked it on Flamingo.Tautonym
@Tautonym Why don't we face this problem in creating a new project? Create a new project. you see Gradles' number is 1_8/1.8 but it works without problem with Java 17Aware
P
140

You can set java version for java with

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

or alternatively:

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(11))
}

and for kotlin with:

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
    kotlinOptions {
        jvmTarget = "11"
    }
}

All samples are in gradle kotlin dsl.

Platonic answered 7/9, 2021 at 8:32 Comment(6)
Note: when I use your tasks.withType<> as is, I get Could not get unknown property 'withType' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer . Error goes away when using tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {; so brackets instead of < >. But unfortunately, that still results in the same warning the questioner asked about ;-(Cappuccino
@Cappuccino I just ran into this using a old build file that used to work properly (with <> not ()), after I updated the kotlin("jvm") version. I presumed it was a gradle API change but could not find a correct way to do this.... then at some point I put this back in (it was just commented out) and go figure, it works. :\ The only significant thing in between was an "invalidate caches and restart", because a newer version of a dependent jar was not being indexed properly. You and your two ticks imply I'm not crazy, although I presume this problem isn't easily reproduced...Counterpoise
Maybe it depends on Kotlin plugin versions. There are various moving parts here.Cappuccino
The question was for build.gradle.kts, tasks.withType<T> { ... } is Kotlin Gradle DSL syntax, tasks.withType(T) { is Gradle Groovy syntax.Raft
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))Dorothi
in my case, I need to apply this config for all the modulesMut
R
58

@Marian's answer didn't quite help me.

I end up setting the following in the app build.gradle

android {
...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget=11
    }
...
}
Rigmarole answered 20/2, 2022 at 13:17 Comment(9)
Did this really work for you? I thought android was restricted to jvm 1.8!Morphophonemics
Since Android Gradle Plugin 7.0, Java 11 is required. And the above works for me.Rigmarole
Yes, I did know that the Android gradle plugin required Java 11. That's the minimum JVM level needed for your builds. Android/compileOption/sourceCompatibiity is the jvm level that you want your android code compiled to, and that's what I understand is limited to version 1.8. I think if you use some java 11 features in your android code, I think it'll break.Morphophonemics
The highest version was already 11 in 2020. See: mobileit.cz/Blog/Pages/android-java-release-train.aspxSapling
This doesn't work with Gradle 7.6 and AGP 7.4.0. It shows in KAPT: 'compileDebugJavaWithJavac' task (current target is 11) and 'kaptGenerateStubsDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version. By default will become an error since Gradle 8.0+! Read more: kotl.in/gradle/jvm/target-validation Consider using JVM toolchain: kotl.in/gradle/jvm/toolchainStarspangled
@Starspangled I don't understand what to do there. What should I change/add/delete?Polymerous
it should be jvmTarget = "11"Denude
It worked in my case.Dismuke
@androiddeveloper in the link they mention what should be updated to make it work for new versions of Gradle. The simplest example using the JVM toolchain is adding kotlin { jvmToolchain(11) }Madeup
W
39

In order to have the 'same version of Java' in both 'Java and Kotlin',
just modify your build.gradle file like this (example given for Java 11):

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
...
android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    // New syntax (credit goes to ʍѳђઽ૯ท in comment)
    kotlin {
        jvmToolchain(11)
    }
/*
    FYI: Old syntax:
    kotlin {
        jvmToolchain {
            languageVersion.set(JavaLanguageVersion.of("11"))
        }
    }
    FYI: Deprecated syntax:
    kotlinOptions {
        jvmTarget = "11"
    }
*/
    ...
}

My configuration:

Gradle:

  • Android Gradle Plugin: com.android.tools.build:gradle:7.4.1
  • Gradle: 7.5 (as of ./gradle/wrapper/gradle-wrapper.properties)

Kotlin:

About new syntax:
See New method for JVM toolchain configuration

NB:
More information about Kotlin configuration regarding that matter is available here: https://blog.jetbrains.com/kotlin/2021/11/gradle-jvm-toolchain-support-in-the-kotlin-plugin/

Waugh answered 9/2, 2023 at 8:29 Comment(3)
Actually, kotlinOptions { jvmTarget = "11" } would work as well; note that the value is a string. re: kotlinlang.org/docs/… But yes, the 1.8 gradle plugin suggests: "Consider using JVM toolchain" (kotlinlang.org/docs/…), as "the kotlinOptions task input and the kotlinOptions{...} task DSL are in support mode and will be deprecated in upcoming releases."Gatha
You could just pass the 11 as a parameter like this as well: jvmToolchain(11)Wyler
The documentation says Specify the toolchain at the top level of your module's build.gradle(.kts) file.Koressa
F
29

I had the same problem after update the Android Studio to Flamingo version, this is my new configs in the build.gradle

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
    jvmTarget = '17'
}
Frankly answered 21/4, 2023 at 21:29 Comment(0)
D
19

I tried with the following code first for all modules

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}
kotlinOptions {
    jvmTarget = '1.8'
}

And after adding the following line into gradle.properties solved the issue.

kotlin.jvm.target.validation.mode = IGNORE
Dismuke answered 3/5, 2023 at 1:44 Comment(2)
ALSO remove packages from buildgradle of all plugins as a temporary Solution. - Recommendation: remove package="io.github.zeshuaro.google_api_headers" from the source AndroidManifest.xml: C:\Users\DBS-05\AppData\Local\Pub\Cache\hosted\pub.dev\google_api_headers-1.5.0+1\android\src\main\AndroidManifest.xml. - Thanks for the Update in gradle.propertiesWhitebait
Good Idea, Why should we decrease the sourceCompatibility and targetCompatibility version?! I did it and solvedGilbart
O
15

This worked nicely for me:

kotlin {
  jvmToolchain {
    languageVersion.set(JavaLanguageVersion.of("11"))
  }
}

That way I only need to set it once.

Oeuvre answered 25/6, 2022 at 9:21 Comment(5)
This was added in Kotlin 1.5.30 and only compatible with Gradle 7.2+Raft
Where do I need to put it? inside of each module or in the root?Deprivation
or maybe in the buildSrc/build.gradle.kts?Deprivation
This worked for me, though I needed to cast the languageVersion like this: (this as JavaToolchainSpec).languageVersionGerstein
@AkbolatSSS I put mine in the build.gradle.kts in the root of the file (not in any sub-hierarchy). I put the suggested answer in its own block. I am using a Ktor project, but the idea is similar for Android projects (im an Android dev too)Soporific
B
9
allprojects {
    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_1_8.toString()
        }
    }
}

by including this task in your build.gradle , tells the compiler to use the JavaVersion = 1.8 in your project.

Babette answered 13/4, 2023 at 12:5 Comment(0)
O
6

If anyone keeps getting warnings about a java compilation task being set to java 1.8 you can add this to the gradle script:

afterEvaluate {
    tasks.withType<JavaCompile>().configureEach {
        sourceCompatibility = JavaVersion.VERSION_11.toString()
        targetCompatibility = JavaVersion.VERSION_11.toString()
    }
}

I was getting warnings on some java compile tasks on AS and this solved it for me.

Octavia answered 22/6, 2022 at 20:9 Comment(0)
M
6

Marian's solution (see above) needs to be applied, but you may still see the same message as a warning especially if you run "gradle build" from a command line. I think if you "synch" with gradle from Android Studio, you might not see the warning message. If you still see the message after properly applying Marian's solution, it's apparently a bogus warning message. My understanding is that the bogus warning message goes away once you upgrade to using kotlin 1.6+. You can disable this bogus warning by adding the following to your gradle.properties file.

kotlin.jvm.target.validation.mode = IGNORE

I'm not recommending the use of the above, but I it certainly solves the issue of seeing the bogus warning message. If you do use it, remember to remove it when it's no longer needed.

The problem for most of us is that we can't upgrade to kotlin 1.6.21 at this time. In order to upgrade to kotlin 1.6.21 you need to upgrade to android gradle 7.4. To upgrade to android gradle 7.4 you need an Android Studio version greater than Dolphin | 2021.3.1, so you would have to use one of the preview versions of Android Studio to do that at this time.

for compatibility information, see https://developer.android.com/studio/releases/gradle-plugin and https://developer.android.com/studio/releases#android_gradle_plugin_and_android_studio_compatibility

Morphophonemics answered 27/1, 2023 at 0:18 Comment(0)
O
6

I fixed this issue by using the same Java Version:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
Odonnell answered 3/8, 2023 at 12:0 Comment(0)
W
5

Surprisingly the culprit is very simple. You need to declare your KotlinCompile task before JavaCompile. Like this

tasks {

    withType<KotlinCompile> {
    
        kotlinOptions {
            freeCompilerArgs = listOf(
                "-Xextended-compiler-checks",
                "-Xinline-classes",
                "-Xjsr305=strict",
                "-Xjvm-default=all",
                "-Xskip-prerelease-check",
            )
            apiVersion = "1.8"
            languageVersion = "1.8"
            jvmTarget = "11"
        }
    }
    
    withType<JavaCompile> {
        sourceCompatibility = "11"
        targetCompatibility = "11"
    }
}
Wooer answered 2/1, 2023 at 17:43 Comment(0)
D
3

I had experienced the same situation and tried different variations mentioned above. The strange behavior that I was having where the project built successfully on the first attempt, but the same error resurfaced when trying to build it again.

Fortunately, I found a workaround that resolved the issue. By reverting back the Gradle version from 8.0 to 7.5, the problem was resolved, and I was able to build the project without any further errors.

Drupe answered 11/7, 2023 at 10:38 Comment(1)
see kotlinlang.org/docs/… . This link shows relationships between versions of KGP (kotlin gradle plugin and min/max Gradle and AGP versions. More than likely, PalFS problem and solution can be explained by compatibility table found in the link!Morphophonemics
T
2

This solution worked for me:

Just replace the statement (or similar to this):

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8.toString() 
}

with

kotlinOptions {
    jvmTarget = "1.8"
}

in all the module level build.gradle files and then sync gradle.

Hope this works. Happy Coding...!

Taxdeductible answered 3/8, 2022 at 9:36 Comment(0)
N
2

For anyone who did everything but still struggling with this problem, try to downgrade your gradle version. In my case I changed 8.0 to 7.5 and it helped.

Negress answered 20/7, 2023 at 8:30 Comment(0)
G
2
  1. Remove package from the manifest tag in AndroidManifesty.xml
  2. add the command below into the project's gradle.properties:

kotlin.jvm.target.validation.mode = IGNORE

  1. make sure the kotlinOptions has been set next to compileOptions:
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}
Gilbart answered 20/7, 2023 at 10:24 Comment(0)
H
2

So, there seems to be a weird special case for kapt here, that's being discussed in KT-55947:

Basically, short of using the new jvmToolkit API (which one might have a lot of reasons not to), the usual way to enforce a certain JVM compatibility level in an android app is as follows:

android {
    //...
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = "11" // Or JavaVersion.VERSION_11.toString()
    }
}

But if you're using kapt for Kotlin 1.8+ chances are it's not picking up the jvmTarget config, and is still "misconfigured" (and your build is, strictly speaking, not 100% reproducible) so you get something like this for the kaptGenerateStubs step:

> Task :XXXXX:kaptGenerateStubsReleaseKotlin
'compileReleaseJavaWithJavac' task (current target is 11) and 'kaptGenerateStubsReleaseKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.

Without using jvmToolkit API, one has to explicitly configure the kapt task like so (all credits go to the knowledgeable people of the KT-55947 issue above)

// app|module-level build.gradle.kts, outside the android {} block

tasks.withType(type = org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs::class) {
    kotlinOptions.jvmTarget = "11"
}
Hardnosed answered 6/10, 2023 at 16:43 Comment(0)
S
2

I see that in other answers, it is suggested to use Java 17. However, it is not needed, we need to use:

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = "1.8"
}

Also, we should have it in each module that we have in our app.

If our module is just java/kotlin one that does not use the Android plugin, then you can add the following lines at the end of the build.gradle file:

compileJava {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

This will solve the issue.

Sealskin answered 27/10, 2023 at 22:5 Comment(0)
H
1

One of the very similar error can be this.. Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

First, I would ask you to go to this path in Android Studio and check what Gradle JDK versions you are using... Simply Goto ->File->Settings->Build,Execution,Development->Build Tools->Gradle Now, see inside Gradle SDK, what version is selected.

Now to fix the error open the 'build.gradle' file for your 'app module'. And to fix it, make sure to check if you have equal java version at two blocks in your 'build.gradle' . The first one is inside the 'compileOptions' , make sure the two lines have similar java versions as you have used in Gradle SDK (checked above),

compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
}

The second block to be checked is 'kotlinOptions', check the Java version here too,

kotlinOptions {
    jvmTarget = '11'
}

And hopefully, this will solve the error.

Hautboy answered 8/7, 2023 at 19:13 Comment(0)
P
1

I was getting this error:

> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (9) and 'kaptGenerateStubsDebugKotlin' (19).

and my gradle was this:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_9
    targetCompatibility JavaVersion.VERSION_1_9
}
kotlinOptions {
    jvmTarget = '19'
}

so Instead of VERSION_1_9 I used VERSION_19

VERSION_1_9 means version 9 but

VERSION_19 means version 19

but then I got this error

Cause: error: invalid source release: 19

so I replace them with this code:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

then it worked and build succeeded.

Pickens answered 24/2 at 11:41 Comment(0)
H
0

Pretty much all the answers are at small variations to each other, mine too.

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlin {
        jvmToolchain(8)
    }

This worked for me. Looks like tool chain defaults to different value else where, this overrides to match compile options and resolves the issue.

Heavyhearted answered 6/7, 2023 at 16:55 Comment(0)
S
0
compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
    }
Stringpiece answered 5/9, 2023 at 7:56 Comment(0)
B
0

// Import this package in gradle.kts :app file.

import org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask

// Paste this in your gradle kts file after android block

tasks.withType(type = KaptGenerateStubsTask::class) {
        kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
    
    }

If you're using Java version 1.8 then replace VERSION_11 with VERSION_1_8

Bodoni answered 14/9, 2023 at 6:58 Comment(0)
C
0

If you are using Android Studio Hedgehog | 2023.1.1 or later, and if you are created a new "module" then you should also need to change the JVM version of "sourceCompatibility" and "targetCompatibility" settings in the respective module's build.graddle.kts file to same as in the main build.graddle.kts file. That means the JVM version should be same in both main build.graddle.kts file and each module's build.graddle.kts file.Check screenshot

Crossbreed answered 31/12, 2023 at 7:56 Comment(0)
S
-1

I solved this problem by updating the configuration in the gradle.properties file.

change

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

to

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

Shope answered 25/4, 2023 at 13:32 Comment(0)
C
-1

I also face the same issue and i have solved this issue. In order to solve this you must have same version of java and kotline running on your system. To solve this you have to add some code in android/gradle file:

buildscript {
    ext.kotlin_version = "1.8.0"
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"


    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

Your app level build.gradle must be matched like:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    namespace "com.example.aargus_shashi_1"
    compileSdkVersion 34
    buildToolsVersion '34.0.0'

    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.aargus_shashi_1"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 19
        multiDexEnabled true
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    dataBinding {
        enabled true
    }
    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    def multidex_version = "2.0.1"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.android.gms:play-services-location:21.0.1'
    implementation "androidx.multidex:multidex:$multidex_version"

}

Your gradle.wrapper.properties file present in //android/gradle/wrapper must be like:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

This error is caused by mismatch of the version which could be usually happen when you integrate old library fucntion or code into your new project.

Carrara answered 15/1 at 5:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.