2
votes

I have a project using androidx and kotlin, I get an error message when running the application as follows:

w: JAR runtime files in the classpath should have the same version. These files were found in the classpath:

w: /Users/arjava/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.31/98678431965f7487d6dc9b399e59b6c4b3921073/kotlin-stdlib-jre7-1.2.31.jar: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead

and one more message directed me to the directory :

.gradle / caches / modules-2 / files-2.1 / org directory. Jetbrains.kotlin / kotlin-stdlib-jre7 / and xxxxxxx

I'm really confused about this problem, even though I don't apply jre in my app.gradle, I try to delete the files and then there will be more and more.

this is my app.gradle file :

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


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.mhdfdl41.android.gotoclinic"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    androidTestImplementation "android.arch.core:core-testing:1.1.1"
    implementation 'com.google.android.material:material:1.1.0-alpha03'
    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.smarteist:autoimageslider:1.1.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.smarteist:autoimageslider:1.1.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.github.humazed:RoomAsset:1.0.3'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.basgeekball:awesome-validation:1.3'
    // AAC (Room, Live Data, View Model)
    implementation "android.arch.persistence.room:runtime:1.1.1"
    kapt "android.arch.persistence.room:compiler:1.1.1"
    kapt "android.arch.lifecycle:compiler:1.1.1"
    // ViewModel and LiveData
    androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"

    //room asset access databases
    implementation 'com.github.humazed:RoomAsset:1.0.3'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation "androidx.test.ext:junit:1.1.0"
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    //anko
    implementation "org.jetbrains.anko:anko:$anko_version"
}

configurations {
    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
repositories{
    mavenCentral()
}

what made this happen?

1

1 Answers

3
votes

This is how the root project's build.gradle should look alike. when I add kotlin-stdlib-jdk7, it still complains about a version mismatch; only kotlin-stdlib (without the postfix) works for me.

buildscript {
    ext.kotlinVersion = "1.3.30"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.4.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
    }
}

plugins {
    id "org.jetbrains.kotlin.jvm" version "1.3.30"
}
repositories {
    mavenCentral()
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
}
...