I researched various things about Butter Knife 8 series (Ver.8.5.1), so it is a summary.
Butter Knife is a View Injection library for Android. View and field methods can be linked using annotations. Click here for GitHub.
Excerpt from README.
build.gradle
dependencies {
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
annotationProcessor is a Gradle plugin Ver.2.Requires 2 or more. If you can't, add the apt library.
[Gradle settings for using APT in Android projects](http://qiita.com/taki4227/items/9fa2a2368ed5414d0897)
#### **`build.gradle`**
```python
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
Note that using the above plugin will change the ID when binding the View from R
to R2
.
It's all written on the Official Site. I will add it later. .. ..
There is a plugin that automatically generates ButterKnife's View Injection in one shot. As far as Release Notes is seen, the latest Ver.1.5.0 supports ButterKnife Ver.8.0.1, so it can be used. Can be used.
However, since the android: id described in XML is automatically generated in the variable name of camel case, it seems that it is not suitable when migrating existing code to Butter Knife. Convenient for new use.
Butter Knife Zelezny Click here for Butter Knife Zelezny Plugin Installation Method.
What you need to do when upgrading from an older version.
You can go to the following site.
Ver.7 → 8 It is mostly written on the following site, but only the build.gradle part is added.
There was an article that describes the disadvantages of Butter Knife, so I will leave it. Goodbye Butter Knife. I liked you without APT
Recommended Posts