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

287 views Asked by At

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.

0

There are 0 answers