moshi: Moshi 1.11.0 and Data Binding crashes Kapt

Hello,

There is a problem with this plugin.

implementation 'com.squareup.moshi:moshi-kotlin-codegen:1.11.0'

which is causing the error.

Execution failed for task ':app:kaptDebugKotlin'.

I had to downgrade to 1.9.3 to get it working.

Please see for more details here: https://stackoverflow.com/questions/65265169/kotlin-missing-kotlin-jvm-internal-functionreferenceimpl-raised-for-kaptdebugko/65266705

Others have confirmed this too.

Many Thanks, Houman

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I had the same problem recently trying to upgrade dependencies on a project. It was not the issue with DataBinding nor ViewBinding. The problem occurs when you try to build the application with both reflect and codegen dependencies added. Even though in the Readme it is stated you can use both.

When you use Kotlin with Moshi you may use reflection, codegen, or both.

After removing one of these dependencies the build worked as expected. So to include Moshi you should use something like this:

implementation('com.squareup.moshi:moshi:1.11.0')
// Choose only one of the approaches bellow
implementation('com.squareup.moshi:moshi-kotlin:1.11.0') // Reflect
kapt('com.squareup.moshi:moshi-kotlin-codegen:1.11.0') // Codegen