Hi,
R2 files inside each feature module works as expected, however I'm getting this issue when building after add all the feature module into app.
Program type already present: a.b.c.R2$anim
I'm using 9.0.0-SNAPSHOT
Can you provide a sample which reproduces this beahvior that we can use to diagnose the problem?
Hi @JakeWharton I have created a sample project that can produce build error Program type already present: a.b.c.R2$dimen
https://github.com/cooperkong/butterknifeR2issue
I guess the issue might be related to using same package name in the AndroidManifest.xml in the library module.
@JakeWharton I have the same issue in a modular project
this problem still exists
the current solution is to give feature module different package name, if it is the intention, we can close this issue. @JakeWharton @ImangazalievM
@cooperkong Do you mean the "package" attribute in the "manifest" tag of AndroidManifest.xml? Because I have a library module with a different package than the application module which uses it and I suddenly got this issue after adding multidex. I can't build the app now, which is, obviously, a major problem.
@JakeWharton I just noticed, this may be unrelated to adding multidex. The issue reports duplicity of a.b.c.R2$color. I have recently moved a color state list file to the color directory when I noticed it was incorrectly located in the drawable directory. Now this state list isn't used through ButterKnife at all, so this might not be related to ButterKnife. On the other hand, now when I remove it, I get the same issue but with R2$dimen... I'm lost.
@NoHarmDan Hi, for me the package name in AndroidManifest fixes the issue. Perhaps you have other library module that have the same package name?, just guessing...
Most helpful comment
Hi @JakeWharton I have created a sample project that can produce build error
Program type already present: a.b.c.R2$dimenhttps://github.com/cooperkong/butterknifeR2issue
I guess the issue might be related to using same package name in the
AndroidManifest.xmlin the library module.