Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6
Asked Answered
H

38

786

When trying to run the Example CorDapp (GitHub CorDapp) via IntelliJ, I receive the following error:

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

How can I modify the IntelliJ settings so that all the bytecode is built with the same JVM target?

Hemicrania answered 26/2, 2018 at 12:41 Comment(3)
I was able to resolve this issue by adding this library to build.gradle dependencies { compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") }Eula
@MunishChandel That is not sufficient. We must also do what the answer below suggests...Stetson
Had the same error when specifying jvmTarget = "15" on Linux but the same project was working on Windows, both on IntelliJ 2020.3. Changed to jvmTarget = "14" and it worked on both. In either case there were no errors from the command line, only in IntelliJ.Brandtr
H
308

You can fix this issue as follows:

  • Open the IntelliJ preferences
  • Go to Build, Execution, Deployment > Compiler > Kotlin Compiler BUT Other Settings > Kotlin compiler if Android Studio > 3.4
  • Change the Target JVM version to 1.8
  • Click Apply
Hemicrania answered 26/2, 2018 at 12:41 Comment(14)
I have this setting fixed to 1.8 already, yet I still see this error when stepping through breakpoints. I primarily see this when hitting vault queries. Any further suggestions? It seems this target JVM bit doesn't fix it entirely.Laraelaraine
On your Project Structure, make sure you also change the Target platform to JVM 1.8 on your Kotlin Facet under the General tab.Retouch
Would you know the instructions to do the same on eclipse?Guardado
And after Apply restart IDE.Soapsuds
This error can appear if there is an unresolved dependency!Cytherea
For me the Kotlin Compiler settings were actually placed in Other Settings section.Latria
If restarting after apply is not enough → Restart & Invalidate caches.Submerse
Unfortunately that doesn't work if you have multiple modules. In that case you need to add ``` kotlinOptions { jvmTarget = "1.8" } ``` for every gradle in a moduleNeldanelia
You should go to Kotlin CompilerStewardess
kotlinOptions { jvmTarget = "1.8" }Chalybeate
I do not see General Tab or Build, Execution, Deployment on Android Studio though.Eyeopener
As others have said, it was already set to 1.8 in the settings. Adding kotlinOptions { jvmTarget = "1.8" } in the build.gradle (Module: app) fixed it.Martella
Doesn't work for me. Solved my problem with kotlinOptionsBacker
The above did not help me. I had to add the below to Module gradle.build file: ` tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 kotlinOptions { jvmTarget = '1.8' apiVersion = '1.1' languageVersion = '1.1' } } ` from here: #44141576Plata
U
1541

app/build.gradle

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

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

GL

Use Java 8 language features

Udine answered 11/7, 2019 at 19:21 Comment(12)
As of this date and Android Studio v3.5 this is the only solution that worked, after trying all the rest. Strangely enough setting the same value in Settings > Kotlin Compiler has no effect.Onaonager
Just the kotlinOptions { jvmTarget = "1.8" } should suffice.Sunbow
@Sunbow Some libraries need both options such as okhttp3:logging-interceptor to use OkHttpClient.Builder().addInterceptorUdine
kotlinOptions { jvmTarget = "1.8" }Chalybeate
Then should "invalidate cache and restart"Wrier
I had already define the compileOption but not kotlinOption after define kotlinOption error gone. Its work for me. Thanks for sharing.Chuipek
And what if this is not for android? Where do the compileOptions and kotlinOptions go?Toponym
@PeterV.Mørch What context are you referring to?Udine
Why some people wrap this kotlinOptions { } inside a tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { } ?Beautiful
@LeonardoSibela In Gradle is that everything is executed against a Interface Project instance. These are tasks executed in the global instance of gradle, that is, at the level of the project module. So this configuration loses sense modularization since it configures all the existing build.gradle in the project.Udine
If you're trying to inline 1.8 bytecode in another Gradle module, you should also put this code in another module too (not just app)Shylashylock
Of course, the scope of the gradle is for the module unless you run tasks on the global gradle instance.Udine
H
308

You can fix this issue as follows:

  • Open the IntelliJ preferences
  • Go to Build, Execution, Deployment > Compiler > Kotlin Compiler BUT Other Settings > Kotlin compiler if Android Studio > 3.4
  • Change the Target JVM version to 1.8
  • Click Apply
Hemicrania answered 26/2, 2018 at 12:41 Comment(14)
I have this setting fixed to 1.8 already, yet I still see this error when stepping through breakpoints. I primarily see this when hitting vault queries. Any further suggestions? It seems this target JVM bit doesn't fix it entirely.Laraelaraine
On your Project Structure, make sure you also change the Target platform to JVM 1.8 on your Kotlin Facet under the General tab.Retouch
Would you know the instructions to do the same on eclipse?Guardado
And after Apply restart IDE.Soapsuds
This error can appear if there is an unresolved dependency!Cytherea
For me the Kotlin Compiler settings were actually placed in Other Settings section.Latria
If restarting after apply is not enough → Restart & Invalidate caches.Submerse
Unfortunately that doesn't work if you have multiple modules. In that case you need to add ``` kotlinOptions { jvmTarget = "1.8" } ``` for every gradle in a moduleNeldanelia
You should go to Kotlin CompilerStewardess
kotlinOptions { jvmTarget = "1.8" }Chalybeate
I do not see General Tab or Build, Execution, Deployment on Android Studio though.Eyeopener
As others have said, it was already set to 1.8 in the settings. Adding kotlinOptions { jvmTarget = "1.8" } in the build.gradle (Module: app) fixed it.Martella
Doesn't work for me. Solved my problem with kotlinOptionsBacker
The above did not help me. I had to add the below to Module gradle.build file: ` tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 kotlinOptions { jvmTarget = '1.8' apiVersion = '1.1' languageVersion = '1.1' } } ` from here: #44141576Plata
G
151

you should configure something like as follows in build.gradle

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
Grownup answered 22/6, 2018 at 16:2 Comment(8)
Or alternatively, in the Gradle Kotlin DSL: tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "1.8" }Parulis
Any idea how to get this to work with kotlin-android plugin?Lemberg
Works without much hassle. I'd recommend itCrenel
I had this in build.gradle, but somehow IDEA overwrote this setting. The Answer from Saeed worked for me.Singlebreasted
Do add this in your app-level Gradle's android {} section.Wives
I get error "A problem occurred evaluating script. > Could not get unknown property 'org' for project ':subprojectName' of type org.gradle.api.Project."Irreverence
@Amuthan, could you please include @ Parag Kadam's remark in your answer? it's essentialHeinrich
This worked for me. For some reason the highly upvoted answer that puts this inside an android block gives me an unresolved reference error.Honniball
C
121

please add this code to android section inside your app/build.gradle

compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
Criminal answered 15/6, 2020 at 23:9 Comment(3)
its working great can you please explain it, why we need to do this and whats its mean.Bushel
it works, when my destination fragment was not able to accept navArgs() and was complaining about inline bytecode built. My app gradle had compile options for source and target but i didnt have kotlinOptions. After i added Kotlin options and clean PRoject> Rebuild Project. worked fine.Bathymetry
It doesn't differ from the top answer.Dielectric
S
90

In my case, just changingTarget JVM Version like this: File > Setting > Kotlin Compiler > Target JVM Version > 1.8 did not help. However, it does resolved compile time error. But failed at runtime.

I also had to add following in app build.gradle file to make it work.

 android {
     // Other code here...
     kotlinOptions {
        jvmTarget = "1.8"
     }
 }
Situation answered 17/9, 2019 at 7:36 Comment(1)
This doesn't work.Cowry
B
65

When the other solutions did not work for you (Changing JVM version on Compiler settings and adding jvmTarget into your build.gradle), because of your .iml files trying to force their configurations you can change the target platform from Project Settings.

  • Open File > Project Structure
  • Go to Facets under Project Settings
    • If it is empty then click on the small + button
  • Click on your Kotlin module/modules
  • Change the Target Platform to JVM 1.8 (also it's better to check Use project settings option)
Bostic answered 1/11, 2018 at 17:45 Comment(4)
I can't find this or the 'facets' section in Android Studio... 🤔 I had to edit the app.iml manually. I set <configuration version="3" platform="JVM 1.8" useProjectSettings="false"> to true and it worked. However, the file keeps changing back!Boethius
@Boethius It's actually under "File" > "Project Structure" then under "Project Settings" > "Facets", I had nothing there, so I cliked "+" > "Kotlin" > Select my project. That did it for me :)Oaf
This works for me, but being forced back to 1.6 every time I add to my build.gradle.kts file.Brede
Is there a way to have this configured and picked up from the gradle file? IMHO this being misconfigured is a bug in intellij.Walachia
S
63

In my case this code didn't work until I moved apply plugin: 'kotlin-android' from bottom to top.

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

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

    kotlinOptions {
        jvmTarget = "1.8"
    }
}
Ssr answered 6/3, 2020 at 13:13 Comment(1)
kotlinOptions { jvmTarget = "1.8" } Didi the trick for me, thxUpend
H
34

In Android Studio 4.3.2 adding through the below procedure is not working.

  1. Open the IntelliJ preferences
  2. Go to Build, Execution, Deployment > Compiler > Kotlin Compiler BUT Other Settings > Kotlin compiler if Android Studio > 3.4
  3. Change the Target JVM version to 1.8
  4. Click Apply

The reason is, Android studio is unable to add the below code in the module level Gradle file. Please add it manually.

kotlinOptions {
    jvmTarget = "1.8"
}

Just for the addon, search Target JVM version in the android studio search. It will take you directly to the option. enter image description here

Howlyn answered 25/7, 2019 at 14:1 Comment(2)
only by adding manually, it worked for me. For some reason, android studio is really buggy and it does not consider changes applied unless we restart the ide by deleting all cache.Anthropophagi
Tnx, your solution worked for me, although I needed to restart android studio to make it reconfigure project!Auliffe
L
29

Feb 2020
android 3.4+
Go to File -> Settings -> Kotlin Compiler -> Target JVM Version > set to 1.8 and then make sure to do File -> Sync project with Gradle files

Or add this into build.gradle(module:app) in android block:

kotlinOptions {
           jvmTarget = "1.8"
         }
Lablab answered 3/2, 2020 at 7:26 Comment(1)
confirmed that you need to do File -> Sync project with Gradle files, then it worksCretin
H
28

If you have many sourcesets/modules it can be cumbersome to configure the jvmTarget for each of them separately.

You can configure the jvmTarget for all of them at once like so:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

This snippet can be used on top level of your gradle.build file

After modifying the gradle file Reimport All Gradle Imports. To check if it worked, open Project Structure and verify that IntelliJ correctly assigned JVM 1.8 to all Kotlin-Modules. It should look like this:

project structure

I would not recommend changing the platform directly in IntelliJ, because anyone else cloning your project for the first time is likely to face the same issue. Configuring it correctly in gradle has the advantage that IntelliJ is going to behave correctly for them right from the start.

Holeproof answered 13/3, 2020 at 11:8 Comment(0)
I
25

As it is written in the using-maven docs from the Kotlin website:

You just have to put <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget> into the properties section of your pom.xml

Invention answered 21/6, 2018 at 19:24 Comment(1)
After trying everything, yours was the only solution that worked for meCamellia
K
24

In my case, jvmTarget was already set in build.gradle file as below.

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

But my issue was still there. Finally, it gets resolved after Changing Target JVM version from 1.6 to 1.8 in Preferences > Other Settings > Kotlin Compiler > Target JVM version. see attached picture,

enter image description here

Kuroshio answered 5/6, 2020 at 5:23 Comment(1)
Great Help, you saved my day too, ThanksPyszka
S
21

This helped my project to build, add this to module build.gradle file:

compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
Scintillant answered 5/10, 2020 at 14:56 Comment(0)
D
17

For me the reason was this configuration in my build gradle was in some modules and in some it wasnt

android {  
...      
kotlinOptions {
        val options = this as KotlinJvmOptions
        options.jvmTarget = "1.8"
    }
...
android {
Downpipe answered 10/7, 2019 at 8:26 Comment(2)
Thanks, this was the only solution that worked for me. I am using kts buiild files.Echoism
Thanks, this is also the solutions that worked for me. And much declarative this way. https://mcmap.net/q/53883/-cannot-inline-bytecode-built-with-jvm-target-1-8-into-bytecode-that-is-being-built-with-jvm-target-1-6 kevin also stated this, due to the smartcast in kotlin gradle files .kts it is available directlyHiragana
H
17

In my case, I solved this by following these two steps

1. Go to android studio preferences -> other settings -> kotlin compiler -> set Target JVM version = 1.8 
   if it doesn't work then go to the second option.

2. In your module-level build.gradle file add 
   compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
Heighho answered 8/9, 2019 at 4:18 Comment(4)
Hey thanks for the answer, I had to do the 2nd step, and its working. Can you explain why it is needed?Lovelorn
you can find more details on this closed issue it's good to know [github.com/mikepenz/Android-Iconics/issues/454]Heighho
That link is deadLovelorn
It doesn't work.Cowry
D
13

For Gradle with Kotlin language (*.gradle.kts files), add this:

android {
    [...]
    kotlinOptions {
        this as KotlinJvmOptions
        jvmTarget = "1.8"
    }
}
Dodge answered 15/7, 2019 at 14:20 Comment(3)
Why do we need to cast this to KotlinJvmOptions. Isn't the this receiver in the kotlinOptions block already KotlinJvmOptions? Still it doesn't work for me without the castSestet
@11m0, I think it's related to this issue: github.com/gradle/kotlin-dsl-samples/issues/1368Matrilocal
When KotlinJvmOptions is not found, try using the full name "org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions".Matrilocal
W
13

The next solution helped me. Add to build.gradle

 compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
Wivestad answered 5/10, 2020 at 12:30 Comment(1)
Useful if you are using this without androidTuckerbag
I
9

in most cases this is enough:

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

if you have declared custom Gradle tasks like integrationTest for example, add a configuration for compile<YourTaskName>Kotlin as well:

compileIntegrationTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
Irreverence answered 10/1, 2020 at 9:26 Comment(2)
this would work too by adding to gradle file --> compileOptions { sourceCompatibility = 1.8 targetCompatibility = 1.8 } kotlinOptions { jvmTarget = "1.8" }Preussen
interestingly, only your solution worked with my non-android module! thanks!Jerroldjerroll
I
9

All answers here are using gradle but if someone like me ends up here and needs answer for maven:

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>11</jvmTarget>
                </configuration>
            </plugin>
        </plugins>
    </build>

The change from jetbrains archetype for kotlin-jvm is the <configuration></configuration> specifying the jvmTarget. In my case 11

Indention answered 29/1, 2020 at 7:4 Comment(0)
P
7

Setting sourceCompatibility = JavaVersion.VERSION_1_8 enables desugaring, but it is currently unable to desugar all the Java 8 features that the Kotlin compiler uses.

enter image description here

Fix - Setting kotlinOptions.jvmTarget to JavaVersion.VERSION_1_8 in the app module Gradle would fix the issue.

Use Java 8 language features: https://developer.android.com/studio/write/java8-support

android {
  ...
  // Configure only for each module that uses Java 8
  // language features (either in its source code or
  // through dependencies).
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  // For Kotlin projects
  kotlinOptions {
    jvmTarget = "1.8"
  }
}
Pilocarpine answered 16/2, 2020 at 7:18 Comment(0)
C
7

You may need to set both compileKotlin and compileTestKotlin. This works on gradle 6.5.1.

compileKotlin {
    kotlinOptions {
        languageVersion = "1.2"
        apiVersion = "1.2"
        jvmTarget = "1.8"
        javaParameters = true   // Useful for reflection.
    }
}

compileTestKotlin {
    kotlinOptions {
        languageVersion = "1.2"
        apiVersion = "1.2"
        jvmTarget = "1.8"
        javaParameters = true   // Useful for reflection.
    }
}
Catamnesis answered 16/7, 2020 at 6:43 Comment(0)
L
6

I'm using Kotlin and Gradle for normal JVM development, (not android) and this worked for me in build.gradle:

allprojects {
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
        kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
    }
}
Lakshmi answered 15/5, 2020 at 13:27 Comment(1)
Worked for me with React Native Android, ThanksHenderson
K
6

if you are in android project

in your app's build.gradle under android{}

android{
//other configs...
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
Kush answered 22/5, 2020 at 15:23 Comment(0)
J
6

I did all steps but didn't success the problem was

implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.32'

when I updated to

implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30'

shows that problem when I back to

implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.32'

the problem fixed

Joule answered 2/9, 2021 at 7:32 Comment(1)
After rebuilding my project it states with this error message "This version (1.0.3) of the Compose Compiler requires Kotlin version 1.5.30 but you appear to be using Kotlin version 1.4.32 which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!)."Hydromechanics
C
5

Using the Kotlin Gradle DSL, this solved the issue for me. I added this to the build.gradle.kts. This is in addition to the answer by Joel

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
Capable answered 4/6, 2020 at 11:39 Comment(2)
Can you please share where exactly in the file you put this? And which version of the android plugin and gradle you are using?Juno
This is not an Android project. I am running Gradle 6.4.Capable
H
5

If non of the above answers works, you can do this in kotlin dsl

    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
        kotlinOptions {
            jvmTarget = "1.8"
        }
}
Holarctic answered 21/12, 2020 at 11:5 Comment(1)
The android block is redundant. The tasks property comes from the Gradle project.Triglyph
G
4

If using Visual Studio Code** with Kotlin extension, go to the plugin management Crtl + Shift + x, type kotlin and click on manage (the little gear) >> Configure Extension Settings

on Kotlin >> Compiler >> Jvm:Target - type the java version. In my situation just typed 1.8

And then restart :-)

** vscode or just 'code' for linux

Gorrono answered 21/8, 2019 at 20:45 Comment(0)
P
4

Nothing worked for me until I updated my kotlin plugin dependency.
Try this:
1. Invalidate cahce and restart.
2. Sync project (at least try to)
3. Go File -> Project Structure -> Suggestions
4. If there is an update regarding Kotlin, update it.
Hope it will help someone.

Portugal answered 8/3, 2020 at 11:58 Comment(1)
the easiest fixPoachy
S
2

If you use Eclipse assuming you downloaded the Kotlin plugin:

Right click project -> Properties -> Kotlin Compiler -> Enable project specific settings -> JVM target version "1.8"

Spirelet answered 12/2, 2019 at 14:48 Comment(0)
A
2

In my case File > Setting > Kotlin Compiler > Target JVM Version > 1.8

Astraddle answered 12/9, 2019 at 18:53 Comment(0)
M
1

For recent versions of Android Studio, if changing just the Kotlin Target VM version didn't work.

File ➞ Project Structure ➞ Modules (app): set both "Source Compatibility" and "Target Compatibility" to "1.8 (Java 8)". Press "OK" and sync project with Gradle.

Mcbride answered 14/9, 2019 at 3:5 Comment(0)
C
1

If you'r facing this message in a Spring Boot/Kotlin project, just set the property "kotlin.compiler.jvmTarget" to "1.8" in your pom.xml.

    <properties>
        <kotlin.version>1.3.70</kotlin.version>
        <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
    </properties>
    ...
Condescendence answered 29/3, 2020 at 16:11 Comment(0)
G
0

Another hint for Eclipse users. After double checking the jvm target settings pointed out by other users, I still had the same problem, and that was caused by missing Kotlin Runtime Library. For eg, when creating a project with spring initializr, it is not added automatically. For adding it: right click on your project -> Build path -> Add libraries... -> User Library, and simply add org.jetbrains.kotlin.core.KOTLIN_CONTAINER

Make sure you refresh your gradle project afterwards (right click -> Gradle -> Refresh gradle project)

Gamb answered 19/2, 2020 at 9:3 Comment(0)
P
0

For me it worked changing from implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30' to implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.32'

Pretypify answered 5/5, 2022 at 14:29 Comment(0)
C
0

I fixed this by navigating to the gradle.build file, and updating the version of the kotlin plugin.

For me, originally the configuration was:

plugins {
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

So I changed the plugin's version to the latest available:

plugins {
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
Cryometer answered 28/7, 2022 at 14:18 Comment(0)
B
0

Tried all the answers from this page, the only thing that worked for me was to use jvmTarget = '11' :

android {
    kotlinOptions {
        jvmTarget = '11' (or any other java version that suits you)
    }
}
Benzine answered 19/4, 2023 at 9:12 Comment(0)
W
0

I had different versions of spring boot installed. Presumably one was built with 17 and wasn't compatible. But, when I downgraded the version to something known to work (2.5.14), everything worked again.

Wiener answered 4/11, 2023 at 4:6 Comment(0)
J
-3

Just add in build.gradle module this code kotlinOptions { jvmTarget = '1.8' }

Joule answered 17/8, 2021 at 6:58 Comment(1)
This has already been mentioned in many other answers.Thorne

© 2022 - 2024 — McMap. All rights reserved.