kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead
Important Update
Must check JDK version before setting config
Kotlin gradle config page has detailed information about this.
First of all check your kotlin version in gradle file.
if (
kotlin_version == '1.2.x'
) (Usejdk
NOTjre
)
First check your jdk version in File > Project Structure.
Or check in build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
if (jdk_version == 1.8)
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
if (jdk_version == 1.7)
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
if (jdk_version is < 1.7)
implementation"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
else if(NO jdk version is set in Project Structure)
if(Android_Studio_Version < 2.2.1){
your_jdk_version = 1.7;
}
else {
your_jdk_version = 1.8;
}
Because Android Studio is bundled with jdk 1.8 since 2.2.1 version.
2. else if (
kotlin_version == '1.1.x'
) (Use jre NOT jdk)
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" // or jre8
Update Kotlin Version?
You can update Kotlin version from Tools > Kotlin > Configure Kotlin Updates
Go to Tools > Kotlin > Configure Kotlin Plugin Updates and check for updates then in your app gradle file replace jre with jdk
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Update
Newer version is jdk8
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"