Skip to content
Bind Android views and callbacks to fields and methods.
Java HTML Kotlin Other
Branch: master
Clone or download

Latest commit

Latest commit 574ed28 Mar 25, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildscript Fix auto-deploy things. Oct 9, 2015
.github/workflows Add `pull_request` to Wrapper Validation Triggers Jan 16, 2020
butterknife-annotations Merge pull request #1458 from AlexKrupa/reflect-onpagechange Feb 6, 2019
butterknife-compiler Properly handle R references as static imports Nov 20, 2019
butterknife-gradle-plugin Use fake ID values for R2 Dec 18, 2019
butterknife-integration-test Properly handle R references as static imports Nov 20, 2019
butterknife-lint Update Lint checks to new APIs Feb 24, 2018
butterknife-reflect More integration tests to exercise reflect backend Feb 8, 2019
butterknife-runtime Switch copyOfRange(x, 0, y) to copyOf(x, y) Sep 12, 2019
butterknife Point test runners at the right type Feb 1, 2019
gradle Use fake ID values for R2 Dec 18, 2019
sample Remove legacy support Jan 4, 2019
website Fix mixed-content error May 23, 2019
.gitignore Remove redundant entry from gitignore (#1088) Sep 28, 2017
.travis.yml Add second license SHA Feb 3, 2019 Prepare version 10.2.1 Dec 19, 2019
LICENSE.txt Initial commit. Mar 5, 2013 Use view binding Mar 24, 2020 Fix typo Jun 28, 2017
build.gradle Update to AGP 3.3 as minimum supported version Sep 7, 2019
checkstyle.xml Add @OnTextChanged support to reflect backend Feb 4, 2019 Deploy Javadoc with the website. Jan 4, 2014 Prepare next development version Dec 19, 2019
gradlew Bump dependencies Jun 24, 2017
gradlew.bat Update android gradle plugin 2.2.0 Oct 5, 2016
settings.gradle Start entirely reflection-backed module Sep 6, 2018

Butter Knife

Attention: This tool is now deprecated. Please switch to view binding. Existing versions will continue to work, obviously, but only critical bug fixes for integration with AGP will be considered. Feature development and general bug fixes have stopped.


Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.

  • Eliminate findViewById calls by using @BindView on fields.
  • Group multiple views in a list or array. 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.
  • Eliminate resource lookups by using resource annotations on fields.
class ExampleActivity extends Activity {
  @BindView( EditText username;
  @BindView( EditText password;

  @BindString(R.string.login_error) String loginErrorMessage;

  @OnClick( void submit() {
    // TODO call server...

  @Override public void onCreate(Bundle savedInstanceState) {
    // TODO Use fields...

For documentation and additional information see the website.

Remember: A butter knife is like a dagger, only infinitely less sharp.


android {
  // Butterknife requires Java 8.
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

dependencies {
  implementation 'com.jakewharton:butterknife:10.2.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'

If you are using Kotlin, replace annotationProcessor with kapt.

Snapshots of the development version are available in Sonatype's snapshots repository.

Library projects

To use Butter Knife in a library, add the plugin to your buildscript:

buildscript {
  repositories {
  dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'

and then apply it in your module:

apply plugin: ''
apply plugin: 'com.jakewharton.butterknife'

Now make sure you use R2 instead of R inside all Butter Knife annotations.

class ExampleActivity extends Activity {
  @BindView( EditText username;
  @BindView( EditText password;


Copyright 2013 Jake Wharton

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.