mercredi 5 avril 2017

Instrumented tests can't run in Android library modules that have Kotlin files

It's basically in the title, I can't run any instrumented tests in Android library modules that contain Kotlin classes. This is regardless of whether the tests depend on the Kotlin classes.

Here are the simplest steps I could reproduce this issue with:

  1. Create a new Android library project with default settings
    • Just to check, run example instrumented test, runs fine
    • Add a Kotlin class
    • Run example instrumented test, still runs fine
  2. Add a new Android library module with all default settings again
  3. Run example instrumented test, works fine
  4. Add a Kotlin file, only containing a class Something
  5. Attempt to run instrumented test again, now the build fails with the following message:

    Error:Execution failed for task ':mylibrary:transformClassesWithDexForDebugAndroidTest'.

    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lco/zsmb/example/mylibrary/Something;

Aucun commentaire:

Enregistrer un commentaire