build.gradle
文件,将ext.kotlin_version
从当前版本(如1.5.0
)增加到最新稳定版本1.6.0
(当时的最新版本)。感谢。
您可以在此处获取最新版本:https://kotlinlang.org/docs/releases.html#release-details。gradle-wrapper-properties
و–‡ن»¶ن¸çڑ„gradle-6.7.1
版وœ¬و›´و”¹ن¸؛gradle-6.9
,ه¹¶و›´و”¹ext.kotlin-version='1.4.32'
,هچ³هڈ¯è§£ه†³è¯¥é—®é¢کم€‚ - Akki Jangirflutter@2.5.2
项目中的设置更改为 1.5.31
可以解决此问题。 - Nick Ribal1.4.30
到1.5.0
时,我遇到了问题。这似乎是一种Gradle
缓存问题。通过将Gradle
从6.7.1
更新到6.9
(或任何其他版本)来解决此问题。gradle-wrapper.properties
文件并更改以下行:
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
改为:
distributionUrl=https://services.gradle.org/distributions/gradle-6.9-all.zip
我在 IntelliJ IDEA 版本:Ultimate 2019.3 中遇到了同样的问题。
当我多次更改 jar 版本并点击调试按钮运行应用程序时,出现了问题。
遵循以下步骤解决了这个问题:
打开 IntelliJ >> 构建 >> 重新构建项目。
之后再次运行应用程序,问题得以解决。
在我的情况下,我的ProjectRoot/build.gradle
中没有buildScript
块或ext.kotlin_version
。相反,有一个描述我的Kotlin版本的plugins
块。
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
将 org.jetbrains.kotlin.android
更改为 1.7.10
,如下所示:
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
这个最终得以解决,希望能帮助到其他人。
我需要更新Kotlin Gradle插件以匹配Kotlin标准库,在{project}/build.gradle
中进行修改。
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{kotlin version}"
}
}
{project}/{app module}/build.gradle
中删除此行:dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:{kotlin version}"
...
}
参考资料:Exception Error博客文章
ext.kotlin_version
来解决它。无论如何,在将构建.gradle文件与正常工作的新独立项目的文件进行比较后,我发现应该更改这里的1.6.0
:dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
...
}
更新到 1.3.2
版本修复了该问题:
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
...
}
当我将androidx.core:core-ktx:1.3.1
升级到androidx.core:core-ktx:1.6.0
时,出现了问题。
这个库的发行说明中提到:
注意:Core和Core-ktx 1.5.0及以上版本只能编译兼容Android 11 SDK。**
https://developer.android.com/jetpack/androidx/releases/core#core_and_core-ktx_version_150_2
解决方法:将你的库降级到1.5.0以下并同步。如果是这种情况,错误将不复存在。
打开Go项目的build.gradle文件,更新"ext.kotlin_version = 1.5.0"
kotlin-gradle-plugin
在build.gradle
项目文件中使用的版本。androidx.core:core-ktx
和kotlin-gradle-plugin
版本之间存在不兼容性。为了解决冲突,我有两个选择。要么升级KGP,要么降级ktx。ext.kotlin_version = '1.3.40' // not compatible with ktx:1.6.0
// ext.kotlin_version = '1.4.31' // upgrading KGP fixes the issue
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
// implementation "androidx.core:core-ktx:1.2.0" // downgrading ktx fixes the issue
implementation "androidx.core:core-ktx:1.6.0" // not compatible with kotlin_version = '1.3.40'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
https://developer.android.com/jetpack/androidx/releases/core
https://developer.android.com/studio/releases