preface
To solve4.11.Version ButterKnife cannot be usedCopy the code
adapter
The ButterKnife was previously used in 3.x, but it doesn’t fit in 4.1.1, so we need to download another one, as shown below:Once you’ve downloaded and installed it, you’ll find that your ButterKnife still doesn’t work. At this point we need to change the path of the plug-in. 3.x and its predecessors are saved in the user root directory, while 4.1.1 is saved in C:\Users\Administrator\AppData\Local\Google\AndroidStudio4.1. AppData is a hidden folder. If you can’t find it, paste the path directly to file Explorer. (Administrator is the name of the computer. Find the folder in the image below, which is where Studio stores the plug-ins.
Cut out the JAR package shown belowAttention! Delete all the other butterknives you downloaded from the folder, or you’ll get some weird bugs (I don’t know what they are). Move the clipped JAR package to the folder shown below (this is your Android Studio installation directory).To do this, your ButterKnife is already installed, just configure it again and add dependencies to your project Gradle
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com. Jakewharton: butterknife: 10.2.3'
}
Copy the code
Reboot Studio and you can use it
Added: butterKnife gets control null pointer problem
Add dependencies:
api 'com. Jakewharton: butterknife: 10.2.3'
annotationProcessor 'com. Jakewharton: butterknife - compiler: 10.2.3'
Copy the code
The Annotation Processing Tool (APT) is an Annotation processor