Butterknife: Error: Program type already present: butterknife.internal.DebouncingOnClickListener$1

Created on 7 Sep 2018  路  2Comments  路  Source: JakeWharton/butterknife

After updating the project to AndroidX.
I am using the Snapshot version of the butterknife library
build.gradle (app)
...
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
...
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } //for new butterknife
}
..

It was working until the commit "Split out the codegen runtime from the reflective lookup" #1326 .
Error: Program type already present: butterknife.internal.DebouncingOnClickListener$1
com.jakewharton:butterknife -> internal -> DebouncingOnClickListener and
com.jakewharton:butterknife-runtime -> internal -> DebouncingOnClickListener

Is there anyway that I can exclude this classes from either of this library ?

Also Have commented on the the commit:
https://github.com/JakeWharton/butterknife/commit/9b59a14b7918b8b1be931d1be692d64475b37339

Needs Info

Most helpful comment

./gradlew build --refresh-dependencies

Solves the issue for me, had similar issue with two of my projects using AndroidX and ButterKnife 9.0.0

All 2 comments

That type only exists in the runtime. The integration tests would fail if it was actually duplicated. This is more likely a Gradle caching problem, an AGP caching problem, or a local build misconfiguration. Nuke your Gradle cache and do a clean build with --refresh-dependencies to fix. Otherwise you'll have to provide a sample project that reproduces the problem which will help diagnose any build misconfiguration.

./gradlew build --refresh-dependencies

Solves the issue for me, had similar issue with two of my projects using AndroidX and ButterKnife 9.0.0

Was this page helpful?
0 / 5 - 0 ratings