I installed the kotlin plugin in my android studio project. The code does not correspond to the problem. It also executes when I call it from the java class. This gives me the warning "Some of the Kotlin libraries attached to this project are in an unsupported format. Please update the libraries or plugin." The println () function is also not 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() }
java android-studio kotlin
gllowmas
source share