androidgradleandroid-multidexandroid-r8

mergeExtDexDebug failing with type defined multiple times error


I have been experiencing this error for a couple of hours now. I was converting java code to kotlin and stumbled upon this.

Type {module}$someclass$1 is defined multiple types: 
...\app\build\intermediates\external_libs_dex_archive\debug\out\{file}.jar:classes.dex,
...\app\build\intermediates\external_libs_dex_archive\debug\out\{file}_0.jar:classes.dex

Even removing the dependency doesn't fix it. It just shows up for another module.

Note: I have multidex enabled. Clean project, rebuild project or invalidate restart did not fix it.


Solution

  • Turns out downgrading gradle fixed the problem. I was using 3.6.3 and going back to 3.6.2 worked.