Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have installed the kotlin plugin into my android studio project.The code complies with out an issue. It also executes when I call it from a java class. It is giving me the warning "Some Kotlin libraries attached to this project have unsupported format.Please update the libraries or the plugin". The println() function is also not being recognized in the IDE.

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()
}
like image 818
gllowmas Avatar asked Sep 02 '14 20:09

gllowmas


People also ask

How do I update my Kotlin plugin?

Update to a new release IntelliJ IDEA and Android Studio suggest updating to a new release once it is out. When you accept the suggestion, it automatically updates the Kotlin plugin to the new version. You can check the Kotlin plugin version in Tools | Kotlin | Configure Kotlin Plugin Updates.

How do I fix Kotlin not configured?

Step 1: Setup the Kotlin Plugin in Android Studio. In order to ensure Android Studio support Kotlin, the first thing is to install the Kotlin Plugin for your Android Studio. Step 2: Add Kotlin classpath to project Build. Step 3: Add Kotlin library and apply Kotlin Plugins in your module Build.

How do I specify Kotlin version?

You can check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. If you have projects created with earlier Kotlin versions, change the Kotlin version in your projects and update kotlinx libraries if necessary.

What is Kotlin plugin?

The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. The plugin supports Kotlin 1.7 and lower.


1 Answers

Your problem comes from using Kotlin 0.8.679 in your Gradle build, which is too new for the Kotlin plugin you are using in the IDE. Two possible solutions:

  • update your plugin to a newer nightly build, or
  • use 0.8.11 in your Gradle build
like image 191
Andrey Breslav Avatar answered Oct 09 '22 23:10

Andrey Breslav