gpt4 book ai didi

android - Kotlin 编译器警告和应用程序无法执行

转载 作者:行者123 更新时间:2023-11-29 18:35:34 25 4
gpt4 key购买 nike

我有一个使用 androidx 和 kotlin 的项目,我在运行应用程序时收到如下错误消息:

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

还有一条消息将我定向到目录:

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

我真的很困惑这个问题,虽然我在我的app.gradle中没有应用jre,但我尝试删除文件然后越来越多。

这是我的 app.gradle 文件:

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()
}

是什么导致了这一切?

最佳答案

这就是根项目的 build.gradle 应该看起来的样子。当我添加 kotlin-stdlib-jdk7 时,它仍然提示版本不匹配;只有 kotlin-stdlib(没有后缀)对我有用。

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}"
}
...

关于android - Kotlin 编译器警告和应用程序无法执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54507018/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com