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


Android databinding error de prueba de unidad Error al analizar las opciones del compilador de enlace de datos. Params:

Cuando intento configurar la prueba de la unidad para mi proyecto del androide de kotlin, resolví el error siguiente. ¿Alguien ha encontrado este tipo de problema antes?

Esto ha sido marcado como un error en el rastreador oficial de errores

     FALLA: La generación falló con una excepción.
    
      * Qué salió mal: 
      Error de ejecución para la tarea ': app: compileDebugUnitTestJavaWithJavac'. 
      > Java.lang.RuntimeException: Error al analizar las opciones del compilador de enlace de datos.  Params: 
        Kapt.annotations: /Users/trevor/Dev/Android/workspace/gitlab-example/app/build/tmp/kapt/debugUnitTest/wrappers/annotations.debugUnitTest.txt 
        Kapt.kotlin.generated: / Usuarios / trevor / Dev / Android / espacio de trabajo / gitlab-example / app / build / tmp / kapt / debugUnitTest / kotlinGenerated 
    
     * Tratar:
     Ejecutar con --info o --debug opción para obtener más salida de registro.

     * La excepción es:
     Org.gradle.api.tasks.TaskExecutionException: Error de ejecución para la tarea ': app: compileDebugUnitTestJavaWithJavac'.
             En org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions (ExecuteActionsTaskExecuter.java:84)
             En org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute (ExecuteActionsTaskExecuter.java:55)
             En org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute (SkipUpToDateTaskExecuter.java:62)
             En org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute (ValidatingTaskExecuter.java:58)
             En org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute (SkipEmptySourceFilesTaskExecuter.java:88)
             En org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute (ResolveTaskArtifactStateTaskExecuter.java:46)
             En org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute (SkipTaskWithNoActionsExecuter.java:51)
             En org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute (SkipOnlyIfTaskExecuter.java:54)
             En org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute (ExecuteAtMostOnceTaskExecuter.java:43)
             En org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute (CatchExceptionTaskExecuter.java:34)
             En org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute (DefaultTaskGraphExecuter.java:236)
             En org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute (DefaultTaskGraphExecuter.java:228)
             En org.gradle.internal.Transformers $ 4.transform (Transformers.java:169)
             En org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:106)
             En org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:61)
             En org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute (DefaultTaskGraphExecuter.java:228)
             En org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute (DefaultTaskGraphExecuter.java:215)
             En org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.processTask (AbstractTaskPlanExecutor.java:77)
             En org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.run (AbstractTaskPlanExecutor.java:58)
             En org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process (DefaultTaskPlanExecutor.java:32)
             En org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute (DefaultTaskGraphExecuter.java:113)
             En org.gradle.execution.SelectedTaskExecutionAction.execute (SelectedTaskExecutionAction.java:37)
             En org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:37)
             En org.gradle.execution.DefaultBuildExecuter.access $ 000 (DefaultBuildExecuter.java:23)
             En org.gradle.execution.DefaultBuildExecuter $ 1.proceed (DefaultBuildExecuter.java:43)
             En org.gradle.execution.DryRunBuildExecutionAction.execute (DryRunBuildExecutionAction.java:32)
             En org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:37)
             En org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:30)
             En org.gradle.initialization.DefaultGradleLauncher $ 3.execute (DefaultGradleLauncher.java:196)
             En org.gradle.initialization.DefaultGradleLauncher $ 3.execute (DefaultGradleLauncher.java:193)
             En org.gradle.internal.Transformers $ 4.transform (Transformers.java:169)
             En org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:106)
             En org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:56)
             En org.gradle.initialization.DefaultGradleLauncher.doBuildStages (DefaultGradleLauncher.java:193)
             En org.gradle.initialization.DefaultGradleLauncher.doBuild (DefaultGradleLauncher.java:119)
             En org.gradle.initialization.DefaultGradleLauncher.run (DefaultGradleLauncher.java:102)
             En org.gradle.launcher.exec.GradleBuildController.run (GradleBuildController.java:71)
             En org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run (ExecuteBuildActionRunner.java:28)
             En org.gradle.launcher.exec.ChainingBuildActionRunner.run (ChainingBuildActionRunner.java:35)
             En org.gradle.launcher.exec.InProcessBuildActionExecuter.execute (InProcessBuildActionExecuter.java:41)
             En org.gradle.launcher.exec.InProcessBuildActionExecuter.execute (InProcessBuildActionExecuter.java:26)
             En org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute (ContinuousBuildActionExecuter.java:75)
             En org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute (ContinuousBuildActionExecuter.java:49)
             En org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute (ServicesSetupBuildActionExecuter.java:44)
             En org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute (ServicesSetupBuildActionExecuter.java:29)
             En org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild (ExecuteBuild.java:67)
             En org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute (WatchForDisconnection.java:47)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute (ResetDeprecationLogger.java:26)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute (RequestStopIfSingleUsedDaemon.java:34)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call (ForwardClientInput.java:74)
             En org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call (ForwardClientInput.java:72)
             En org.gradle.util.Swapper.swap (Swapper.java:38)
             En org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute (ForwardClientInput.java:72)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute (LogAndCheckHealth.java:55)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.LogToClient.doBuild (LogToClient.java:60)
             En org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild (EstablishBuildEnvironment.java:72)
             En org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36)
             En org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120)
             En org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run (StartBuildOrRespondWithBusy.java:50)
             En org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run (DaemonStateCoordinator.java:297)
             En org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute (ExecutorPolicy.java:54)
             En org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run (StoppableExecutorImpl.java:40)
     Causado por: java.lang.RuntimeException: java.lang.RuntimeException: Error al analizar las opciones del compilador de enlace de datos.  Params:
     Kapt.annotations: /Users/trevor/Dev/Android/workspace/gitlab-example/app/build/tmp/kapt/debugUnitTest/wrappers/annotations.debugUnitTest.txt
     Kapt.kotlin.generated: / Usuarios / trevor / Dev / Android / espacio de trabajo / gitlab-example / app / build / tmp / kapt / debugUnitTest / kotlinGenerated
             En com.sun.tools.javac.main.Main.compile (Main.java:553)
             En com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:129)
             En com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:138)
             En org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute (JdkJavaCompiler.java:46)
             En org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute (JdkJavaCompiler.java:33)
             En org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors (NormalizingJavaCompiler.java:104)
             En org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute (NormalizingJavaCompiler.java:53)
             En org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute (NormalizingJavaCompiler.java:38)
             En org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute (CleaningJavaCompilerSupport.java:35)
             En org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute (CleaningJavaCompilerSupport.java:25)
             En org.gradle.api.tasks.compile.JavaCompile.performCompilation (JavaCompile.java:206)
             En org.gradle.api.tasks.compile.JavaCompile.compile (JavaCompile.java:187)
             En org.gradle.api.tasks.compile.JavaCompile.compile (JavaCompile.java:130)
             En com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile (AndroidJavaCompile.java:49)
             En org.gradle.internal.reflect.JavaMethod.invoke (JavaMethod.java:73)
             En org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ IncrementalTaskAction.doExecute (DefaultTaskClassInfoStore.java:163)
             En org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute (DefaultTaskClassInfoStore.java:134)
             En org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute (DefaultTaskClassInfoStore.java:123)
             En org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction (ExecuteActionsTaskExecuter.java:95)
             En org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions (ExecuteActionsTaskExecuter.java:76)
             ... 70 más
     Causado por: java.lang.RuntimeException: No se pudo analizar las opciones del compilador de enlace de datos.  Params:
     Kapt.annotations: /Users/trevor/Dev/Android/workspace/gitlab-example/app/build/tmp/kapt/debugUnitTest/wrappers/annotations.debugUnitTest.txt
     Kapt.kotlin.generated: / Usuarios / trevor / Dev / Android / espacio de trabajo / gitlab-example / app / build / tmp / kapt / debugUnitTest / kotlinGenerated
             En android.databinding.annotationprocessor.ProcessDataBinding.readArguments (ProcessDataBinding.java:159)
             En android.databinding.annotationprocessor.ProcessDataBinding.process (ProcessDataBinding.java:65)
             En org.jetbrains.kotlin.annotation.AnnotationProcessorWrapper.process (AnnotationProcessorWrapper.kt: 129)
             En com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:794)
             En com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs (JavacProcessingEnvironment.java:705)
             En com.sun.tools.javac.processing.JavacProcessingEnvironment.access $ 1800 (JavacProcessingEnvironment.java:91)
             En com.sun.tools.javac.processing.JavacProcessingEnvironment $ Round.run (JavacProcessingEnvironment.java:1035)
             En com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1176)
             En com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1170)
             En com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:856)
             En com.sun.tools.javac.main.Main.compile (Main.java:523)
             ... 89 más
     Causado por: java.lang.NumberFormatException: null
             En android.databinding.tool.DataBindingCompilerArgs.readFromOptions (DataBindingCompilerArgs.java:92)
             En android.databinding.annotationprocessor.ProcessDataBinding.readArguments (ProcessDataBinding.java:152)
             ... más


Mis scripts gradle son los siguientes:

     Aplique el complemento: 'com.android.application'
     Aplique el complemento: 'kotlin-android'

     Androide
         CompileSdkVersion 25
         BuildToolsVersion "25.0.2"
         DefaultConfig {
             ApplicationId "com.example.abce"
             MinSdkVersion 15
             TargetSdkVersion 25
             VersionCode 1
             VersionName "1.0"
             TestInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         }
         BuildTypes {
             lanzamiento {
                 MinifyEnabled false
                 ProguardFiles getDefaultProguardFile ('proguard-android.txt'), 'proguard-rules.pro'
             }
         }

         el enlace de datos {
             Enabled = true
         }
     }

     Kapt {
         GenerateStubs = true
     }

     Dependencias {
         Compile fileTree (dir: 'libs', include: ['* .jar'])
         AndroidTestCompile ('com.android.support.test.espresso: espresso-core: 2.2.2', {
             Excluir grupo: 'com.android.support', módulo: 'support-annotations'
         })
         Compile 'com.android.support:appcompat-v7:25.2.0'
         Compile 'com.android.support.constraint: constraint-layout: 1.0.1'

         Compilar "org.jetbrains.kotlin: kotlin-stdlib: $ kotlin_version"
         Kapt "com.android.databinding: compilador: 2.3.0"

         TestCompile 'junit: junit: 4.12'
         TestCompile "org.jetbrains.kotlin: kotlin-test-junit: $ kotlin_version"
     }
     Repositorios {
         MavenCentral ()
     }


     Buildscript {
         Ext.kotlin_version = '1.1.0'
         Repositorios {
             Jcenter ()
         }
         Dependencias {
             Classpath 'com.android.tools.build:gradle:2.3.0'
             Classpath "org.jetbrains.kotlin: kotlin-gradle-plugin: $ kotlin_version"

             // NOTA: no coloque las dependencias de la aplicación aquí;  ellos pertenecen
             // en los módulos de módulo build.gradle individuales
         }
     }

     Todos los proyectos
         Repositorios {
             Jcenter ()
         }
     }

     Tarea limpia (tipo: Borrar) {
         Eliminar rootProject.buildDir
     }


     Import org.junit.Assert.assertEquals
     Import org.junit.Test

     Todos los derechos reservados
      * Ejemplo de prueba de unidad local, que se ejecutará en la máquina de desarrollo (host).

      * @see [Documentación de prueba] (http://d.android.com/tools/testing)
      * /
     Clase EjemploUnitTest {
         @Prueba
         @Throws (Exception :: class)
         Fun add_isCorrect () {
             AsertEquals (4, (2 + 2) .toLong ())
         }

         @Prueba
         Diversión additon_isNotCorrect () {
             AsertEquals (4, (2 + 3))
         }
     }

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