Michael Konz
Michael Konz

Reputation: 543

Android Studio redeclaration error when compiling release while having Kotlin Poet generated classes

My app uses Kotlin Poet to generate some classes at compile time. These classes are generated in app/build/generated/source/kaptKotlin [main] and there in two subfolders debug."packagename" and release [main]/"packagename", depending on if I compile for debug or release.

When I compile for debug and then for release both subfolders will be present and thus resulting in a compiler error Redeclaration: classname.

I can work around that by deleting the opposite subfolder before I compile, i.e. deleting the debug subfolder when I compile for release and vice versa.

Still this is annoying and I am wondering if there are some settings I could apply to avoid this.

Upvotes: 1

Views: 428

Answers (0)

Related Questions