Questions tagged [butterknife]

An annotation-based Android view "injection" framework aimed at reducing boilerplate.

View "injection" library for Android which uses annotation processing to generate boilerplate code for you.

  • Eliminate findViewById calls by using @Bind on fields.
  • Group multiple views in a list using @BindViews. Operate on all of them at once with actions, setters, or properties.
  • Eliminate anonymous inner-classes for listeners by annotating methods with @OnClick and others.

The documentation includes additional code examples and use cases.

ButterKnife is open sourced under Apache 2.0 license.

536 questions
10
votes
1 answer

Proguard Duplicate Zip Entry

I am trying to run my android application through Proguard, however this keeps appearing: Warning:Exception while processing task java.io.IOException: Can't write…
aliaksei
  • 714
  • 1
  • 9
  • 23
10
votes
3 answers

Is there anything butterknife can do that databinding can't?

we're just starting a new project And it seems like both butterknife and databinding are awesome tools to reduce boilerplate code. We started with butterkife and added databinding later, the idea is to not have viewmodel classes in java instead…
Mr.Me
  • 9,192
  • 5
  • 39
  • 51
10
votes
5 answers

Butterknife does not work with Include tag

I have a CoordinatorLayout where I have my Button:
Sarah Pöhler
  • 550
  • 1
  • 7
  • 18
10
votes
1 answer

Implementing events Spinner with Butter Knife

First: We need to reference the spinner @Bind(R.id.field_type_id) Spinner mTypeIdSpinner; Second: Create string array One Two Three Four
yaircarreno
  • 4,002
  • 1
  • 34
  • 32
10
votes
2 answers

Cannot find symbol class on Butter Knife generated code

I'm trying to use butter knife but having trouble with the generated code. It's complaining with a namespace... I don't know why. error: cannot find symbol class Detail To simplify see all peaces, I take a print. Can you help…
Tiago Gouvêa
  • 15,036
  • 4
  • 75
  • 81
10
votes
2 answers

Does butterknife 7.x work with Kotlin M14?

I'm trying to use Butterknife with some Kotlin code and also Java code. I know that before M12, there was bad or no support for annotation processing that ButterKnife required. So I have kept my activities in Java. It was working at least in Java…
Vojtěch Sázel
  • 538
  • 6
  • 22
9
votes
1 answer

Android: Why do we need to use R2 instead of R with butterknife?

I've been using butterknife for a few months and I've just noticed in its documentation that it says: Now make sure you use R2 instead of R inside all Butter Knife annotations. Why is that? I've been using R and everything works perfect.
TheCrafter
  • 1,909
  • 2
  • 23
  • 44
9
votes
1 answer

Why can't ButterKnife bind fields that are in private inner classes?

In a fragment, I have a button that opens up a PopupWindow. private class onMenuClickListener implements View.OnClickListener { @BindView(R.id.popup_radiogroup) RadioGroup popupRadioGroup; @BindView(R.id.popup_textview) TextView…
ranys
  • 256
  • 2
  • 9
9
votes
2 answers

What is the difference between `@Bind` and `@BindView` in butterknife?

I Just started using butterknife. In the project, colleagues using butterknife, version is 7.0.0. I saw him write @Bind(R.id.tv_name). But I see butterknife official website butterknife version is 8.0.1, syntax is @BindView(R.id.tv_name) Is…
iRuoBin
  • 123
  • 1
  • 8
9
votes
3 answers

Kotlin annotation processing ignores items with similar names

I recently converted the majority of my project to kotlin. Now I encounter several unusual errors that all seem to relate to annotation libraries. Needless to say, it didn't happen in Java. I'll describe the cases - one in Dagger and one in…
maxandron
  • 1,650
  • 2
  • 12
  • 16
9
votes
3 answers

Butter Knife - Unable to bind views for Fragment

I get an exception java.lang.RuntimeException: Unable to bind views for Fragment on ButterKnife.bind(this, view). The code is as shown below: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, …
Mufaddal Gulshan
  • 1,223
  • 3
  • 11
  • 14
9
votes
1 answer

Bind array of strings in the butterknife

I'm trying to bind array of strings using butterknife. But seems that there is no way (but in processor there is a method to bind array). Here is my code: strings.xml VK Facebook
Anton Shkurenko
  • 4,301
  • 5
  • 29
  • 64
8
votes
5 answers

How to handle butter knife bind in both Baseactivity and sub activities?

There is a BaseActivity with a layout and a sub Activity that extends this BaseActivity. How do you bind views so that views in BaseActivity are binded in BaseActivity and views in Sub activity are binded there ? Here is a sample code explaining the…
oldcode
  • 1,669
  • 3
  • 22
  • 41
8
votes
4 answers

Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { jcenter() mavenCentral() maven { url "https://jitpack.io" } } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' …
NickUnuchek
  • 11,794
  • 12
  • 98
  • 138
8
votes
4 answers

Cannot find symbol class Bind of butterknife

Somehow I have a mistake in my gradle build. Somehow I cannot find the class Bind of butterknife. It is probably due to my gradle, but I do not know. I get this error: Error:(40, 6) error: cannot find symbol class Bind My grade file looks like…
35Hunne
  • 127
  • 2
  • 9