Join FlipAndroid.COM Telegram Group: https://t.me/joinchat/F_aqThGkhwcLzmI49vKAiw


El proyecto no se construirá con Kotlin 1.1.3

Tengo un proyecto de Android que he actualizado recientemente con 1.1.3, y cada vez que construyo consigo el siguiente error:

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

Otras preguntas típicamente dicen que significa que stdlib no está incluido, pero definitivamente lo he añadido. Usando 1.1.2-5 funciona sin embargo, y 1.1.3 ha trabajado para otros proyectos.

Solución

El problema era conmigo mezclando el procesador de anotación con kapt. Para proyectos como DbFlow y Glide, la dependencia annotationProcessor se puede usar directamente con kapt.

De vuelta a la pregunta original:

Aquí está mi registro de Travis y abajo están mis dependencias:

 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; } } 

Aquí está la salida de error cuando intento construir con un stacktrace completo: [Eliminado porque este post era demasiado largo] No estoy seguro si ayuda, pero dbflow normalmente tiene la advertencia de cada compilación ya que no necesita generar las clases cada hora. He enviado una pregunta a su repo, pero no creo que sea el problema ya que funciona bien con 1.1.2-5

Editar 2: he ./gradlew dependencies un vistazo a ./gradlew dependencies y todos ellos mostraron kotlin 1.1.3 (demasiado tiempo para publicar aquí). Había algunos que dependían de 1.1.0 de sus fuentes github, pero que no debería verse afectado y excluir los std-libs no resolvió el error.

Editar 3: Al intentar .gradlew app:dependencies | grep org.jetbrains.kotlin .gradlew app:dependencies | grep org.jetbrains.kotlin Tengo lo siguiente:

 $ ./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 (*) 

  • Android databinding error de prueba de unidad Error al analizar las opciones del compilador de enlace de datos. Params:
  • Smartcast es imposible porque propery tiene getter abierto o personalizado
  • Kotlin - Error intermitente de "archivo de clase incorrecta"
  • "No hay suficiente información para inferir el parámetro T" con Kotlin y Android
  • Kotlin palabra clave en línea que causa IntelliJ IDEA Reporte de cobertura 0%
  • Kotlin: Iterate a través de un JSONArray
  • ¿Cómo funciona la sintaxis de acceso a propiedades de Kotlin para las clases Java?
  • Persistencia de la habitación: Error: Entidades y Pojos deben tener un constructor público utilizable
  • 3 Solutions collect form web for “El proyecto no se construirá con Kotlin 1.1.3”

    En mi experiencia, usted:

    1. No debe mezclar kapt y annotationProcessor
    2. Utilice kapt3 , utilizando el apply plugin: 'kotlin-kapt'
    3. No utilice kapt { generateStubs true } } (no está permitido con kapt3 )

    También compruebe si su complemento Kotlin y su complemento Gradle están actualizados.
    Además, normalmente no uso la versión jre7 de la lib estándar, pero dudo que este sea el problema aquí.

    Aquí está una lista más exhaustiva de "algo con Kotlin no funciona": https://gist.github.com/lmller/3c43eff454f7508474210fb2491b488a

    El mensaje de error informó como:

    Java.lang.NoSuchMethodError:

    Kotlin.jvm.internal.FunctionReference. <Init> ( ILjava / lang / Object; ) V es constructor (Int, Object)

    El constructor se introduce en kotlin 1.1 como se indica a continuación:

     @SinceKotlin(version = "1.1") public FunctionReference(int arity, Object receiver) { super(receiver); this.arity = arity; } 

    Puede ejecutar ./gradlew dependencies y buscar qué dependencia utiliza kotlin-stdlib versión < 1.1 . Y lo excluye de su proyecto. Algo como esto a continuación:

     dependencies{ compile('which dependency use stdlib < 1.1'){ exclude group:'org.jetbrains.kotlin', module:'kotlin-stdlib' } } 

    añadir:

    Aplicar plugin: 'kotlin-kapt'

    Introduzca aquí la descripción de la imagen

    FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.