Hey, I'm trying to create a list of views with ButterKnife Binding but the library not working as expected.
This is my code where I'm creating list of views.
@BindViews({R.id.trackerHistoryExpandImageView, R.id.trackerHistoryExtraLayout})
List<View> viewList;
Library correctly made list of views but when I debug my code I got the error in library.
This is the ButterKnife generated code looks like for the list of views.
target.viewList = Utils.listOf(
Utils.findRequiredView(source, R.id.trackerHistoryExtraLayout, "field 'viewList'"),
Utils.findRequiredView(source, R.id.trackerHistoryExtraLayout, "field 'viewList'"));
You see the views Utils class is finding, the same view for both time "R.id.trackerHistoryExtraLayout";
This is my library version for butterknife.
// Butter knife dependencies
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
Any help would be highly appreciable.
Seems to have been caused by the new rScanner in https://github.com/JakeWharton/butterknife/pull/1244
Anyone have a clue if there is a workaround at the moment? Besides locking to an artifact prior to the PR merge.
As a temporary fix, use the previous snapshot version of ButterKnife-compiler:
dependencies {
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-20180329.192335-32'
}
@sir-boformer That's what we ended up doing today. One downside is that at some point that artifact will disappear from the maven repo. We opted for downloading the specific snapshot jar and pointing to it locally. One downside of that is that you need to provide the dependencies that the compiler needs as well (although not locally):
annotationProcessor files("$project.rootDir/jars/butterknife-compiler-9.0.0-20180329.192335-32.jar")
annotationProcessor 'com.squareup:javapoet:1.10.0'
annotationProcessor 'com.jakewharton:butterknife-annotations:9.0.0-SNAPSHOT'
annotationProcessor 'com.google.auto:auto-common:0.10'
annotationProcessor 'com.google.guava:guava:24.0-jre'
@fxdemolisher I'm sorry, though, i'm not so experienced in this kind of stuff but how can i get such .jar
@mauronra we grabbed the compiler snapshot from here and the main runtime snapshot from here. In my team we wanted the runtime and compiler versions to match but you may only need to do this trick with the compiler.
Keep in mind, the one from this morning (butterknife-compiler-9.0.0-20180411.055511-33.jar) has the issue so you probably want the previous one (butterknife-compiler-9.0.0-20180329.192335-32.jar)
@fxdemolisher thank you, very much, it works now
Im looking into the issue. Thanks for the report
I think I figured out the problem. Fix will be up in a bit
Most helpful comment
@mauronra we grabbed the compiler snapshot from here and the main runtime snapshot from here. In my team we wanted the runtime and compiler versions to match but you may only need to do this trick with the compiler.
Keep in mind, the one from this morning (butterknife-compiler-9.0.0-20180411.055511-33.jar) has the issue so you probably want the previous one (butterknife-compiler-9.0.0-20180329.192335-32.jar)