Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project won't build with Kotlin 1.1.3

Tags:

android

kotlin

I have an Android project that I've recently updated with 1.1.3, and every time I build I get the following error:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> kotlin.jvm.internal.FunctionReference.<init>(ILjava/lang/Object;)V

Other questions typically say that it means that the stdlib is not included, but I have definitely added it. Using 1.1.2-5 works though, and 1.1.3 has worked for other projects.

Solution

The issue was with me mixing the annotation processor with kapt. For projects like DbFlow and Glide, the annotationProcessor dependency can be directly used with kapt.

Back to the original question:

Here is my Travis log and below are my dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.3-alpha', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    compile("ca.allanwang:kau:${KAU}")

    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:${KOTLIN}"
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}"

    debugCompile "com.squareup.leakcanary:leakcanary-android:${LEAK_CANARY}"
    releaseTestCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"
    releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"
    testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"

    compile "com.github.Raizlabs.DBFlow:dbflow:${DBFLOW}"
    compile "com.github.Raizlabs.DBFlow:dbflow-core:${DBFLOW}"
    annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${DBFLOW}"
    kapt "com.github.Raizlabs.DBFlow:dbflow-processor:${DBFLOW}"
    compile "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${DBFLOW}"

    //Icons
    compile "com.mikepenz:material-design-iconic-typeface:${IICON_MATERIAL}@aar"
    compile "com.mikepenz:community-material-typeface:${IICON_COMMUNITY}@aar"

    compile "org.jsoup:jsoup:${JSOUP}"

    compile "com.github.bumptech.glide:glide:${GLIDE}"
    annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE}"

    compile("com.mikepenz:materialdrawer:${MATERIAL_DRAWER}@aar") {
        transitive = true
    }
    compile "co.zsmb:materialdrawer-kt:${MATERIAL_DRAWER_KT}"

    compile "nz.bradcampbell:paperparcel:${PAPER_PARCEL}"
    compile "nz.bradcampbell:paperparcel-kotlin:${PAPER_PARCEL}"
    kapt "nz.bradcampbell:paperparcel-compiler:${PAPER_PARCEL}"

    compile "com.jude:swipebackhelper:${SWIPE_BACK}"

    compile("com.crashlytics.sdk.android:crashlytics:${CRASHLYTICS}@aar") {
        transitive = true;
    }
}

Here is the error output when I try building with a full stacktrace: [Removed because this post was too long] I'm not sure if it helps, but dbflow typically has the warning each build since it does not need to generate the classes every time. I've sent a question to their repo but I don't think that is the issue since it works fine with 1.1.2-5

Edit 2: I had a look at ./gradlew dependencies and all of them showed kotlin 1.1.3 (too long to post here). There were some that depended on 1.1.0 from their github sources, but that shouldn't be affected and excluding those std-libs did not resolve the error.

Edit 3: Upon trying .gradlew app:dependencies | grep org.jetbrains.kotlin I get the following:

$ ./gradlew app:dependencies | grep org.jetbrains.kotlin
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.0.4 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3 -> 1.1.3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
+--- org.jetbrains.kotlin:kotlin-annotation-processing:1.1.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1 -> 1.1.2-3
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3 -> 1.1.3 (*)
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3 (*)
like image 354
Allan W Avatar asked Jun 26 '17 22:06

Allan W


People also ask

How do I fix the module was compiled with an incompatible version of Kotlin the binary version of its metadata is 1/5 1 Expected version is 1 1 16?

To Solve Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5. 1, expected version is 1.1. 16 Error You Can try to rebuild your project By Open Open IntelliJ >> Select Build >> Rebuild Project and then run your application again and your error will be solved.

How do I change my Kotlin Android version?

In your Android studio, Go to Tools -> Kotlin -> Configure Kotlin Updates.

How do I know what version of Kotlin project I have?

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 version in Tools | Kotlin | Configure Kotlin Plugin Updates.


1 Answers

In my experience, you:

  1. Should not mix kapt and annotationProcessor
  2. Use kapt3, by using apply plugin: 'kotlin-kapt'
  3. Do not use kapt { generateStubs true } } (it's not allowed with kapt3)

Also check whether your Kotlin plugin and your Gradle plugin are up to date.
Additionally I usually don't use the jre7 version of the standard lib, but I doubt that this is the issue here.

Here is a more exhaustive list of "something with Kotlin doesn't work": https://gist.github.com/lmller/3c43eff454f7508474210fb2491b488a

like image 181
Lovis Avatar answered Oct 01 '22 14:10

Lovis