gpt4 book ai didi

java - "Some Kotlin libraries attached to this project have unsupported format.Please update the libraries or the plugin"

转载 作者:IT老高 更新时间:2023-10-28 13:41:22 27 4
gpt4 key购买 nike

我已将 kotlin 插件安装到我的 android studio 项目中。代码符合问题。当我从 java 类调用它时它也会执行。它给了我警告“附加到这个项目的一些 Kotlin 库的格式不受支持。请更新库或插件”。 IDE 中也无法识别 println() 函数。

test.kt

fun foo(){
println("ad")
}



public class iTar{
public fun printAll( vararg a: String ){
for(item in a)println(item)
}
}

Build.Gradle

buildscript 
{
ext.kotlin_version = '0.8.679'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}


}

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

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}

defaultConfig {
applicationId "xxxxx"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}


}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'org.mapsforge:svg-android:0.4.3'
compile 'com.android.support:support-v4:20.+'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

repositories {
mavenCentral()
}

最佳答案

您的问题来自在 Gradle 构建中使用 Kotlin 0.8.679,这对于您在 IDE 中使用的 Kotlin 插件来说太新了。两种可能的解决方案:

  • 将您的插件更新为更新的夜间版本,或
  • 在您的 Gradle 构建中使用 0.8.11

关于java - "Some Kotlin libraries attached to this project have unsupported format.Please update the libraries or the plugin",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25632134/

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