Brook MG
Brook MG

Reputation: 671

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.

Upvotes: 2

Views: 2811

Answers (2)

Denesh
Denesh

Reputation: 21

\app\build\intermediates\external_libs_dex_archive\debug*out*{file}.jar:classes.dex

Just delete the directory or folder I have marked in the above path with bold letters(out). Then run the project this error does not come. In my case it solve my problem. Which folder contains the duplicates just delete the folder. when we run the project it will generate the dependencies in that location. no files were there so the error not occured

Upvotes: 1

Brook MG
Brook MG

Reputation: 671

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

Upvotes: 3

Related Questions