Solvedbutterknife Android X support

I've recently attempted to upgrade a project which uses Butterknife v8.8.1 to make use of the new Android X libraries by using the jetifier tool in Android Studio.

The project fails to compile as the generated _ViewBinding classes reference the old android.support.annotation. annotations which no longer exist.
There may also be additional issues I'm not aware of.

I was just wondering if there was a plan to migrate over to reference the new androidx package names in the generated code.

I'm not familiar with the Butterknife code, but let me know if there's anything I could contribute to the project to facilitate adding support.

Thank you for your time

18 Answers

✔️Accepted Answer

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'

Other Answers:

@siavash-sajjad try butterknife 9+ first. then you'll need to add android.jetifier.blacklist=butterknife-compiler to gradle.properties to exclude butterknife compiler from being jetified

implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'

Um, in terms of production code how safe is this on a scale of 1-10 where 1="wtf are you doing this shouldn't be in the same room as a production app"

Ok, now it works, just be sure to put it inside the repositories inside allprojects and not the one inside buildscript