只需要在module的build.gradle文件中加入下列代码即可:
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.1.1' testCompile 'junit:junit:4.12' compile 'com.jakewharton:butterknife:8.5.1' // 添加这行 annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' // 添加这行 }