Hi,
Bug is in version 8.0.1
I've found out that making faulty holder like this one (with same 2 IDs), will give you compile error without any message of what happened.
public static class Holder1 extends RecyclerView.ViewHolder {
@BindView(R.id.item)
public View view1;
@BindView(R.id.item)
public View view2;
public Holder1(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
I get error: Attempt to use @BindView for an already bound ID 2131558672 on 'view1' along with class, line number and everything.
And there's a test for that message being displayed: https://github.com/JakeWharton/butterknife/blob/31c1a959252592696d6aa16186c1d69493ca8b87/butterknife-compiler/src/test/java/butterknife/BindViewTest.java#L828
I'm sorry I'm unable to reproduce this in clean new project.
I thought it had something to do with conflict with AndroidAnnotations library, but message do appear with this library present.
I'm still able to reproduce this without trouble in my regular project, just by making copy of any binded field inside any holder. I've check if this has something to do with "@Ebean" annotation on Adapter, but it doesn't, also checked if different packages could cause this, but also nothing.
I don't know how but maybe problem lies somewhere else.
If I ever reproduce this I'll write again.
@SimonVT did you find the solution for the problem ?
There's no issue, the error I posted is the intended behavior. Don't bind
the same View multiple times.
On Mon, Aug 1, 2016, 12:21 Muazzam Ali [email protected] wrote:
@SimonVT https://github.com/SimonVT did you find the solution for the
problem ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/JakeWharton/butterknife/issues/593#issuecomment-236543980,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhh9VzspN6j4LVBIrtt53jz9s4JjrA5ks5qbcingaJpZM4ImYb-
.
My case is bind a view with wrong view type, it will cause the similar error.
For example
Your activity_main.xml maybe
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
Your MainActivity.java maybe
public static class MainActivity extends AppCompatActivity {
@BindView(R.id.main_content)
LinearLayout mainContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this)
}
}
I have experienced a variance of this issue. Reported here: https://issuetracker.google.com/issues/143550689
Most helpful comment
There's no issue, the error I posted is the intended behavior. Don't bind
the same View multiple times.
On Mon, Aug 1, 2016, 12:21 Muazzam Ali [email protected] wrote: