The use of butterknife and the solution of a common mistake

  The first is butterknife's dependencies.

  Enter the following code under dependencies in the build.gradle file, and then refactor the program once to complete.

    compile'com.jakewharton:butterknife:5.1.1'But
 after I add dependencies, butterknife often has errors, and later I know that I need to add the following code when an error occurs. Add the following code in the android{defaultConfig{} of the build.gradle file as follows code
    

    javaCompileOptions {
      annotationProcessorOptions {
      includeCompileClasspath = true
    }

  From file->seting->Plugins, you can download a ButterKnife Zelezny plug-in. With this plug-in, you can quickly bind controls and onclick events by performing the following operations.

  First right-click on the activity in setContentView(R.layout.activity_main); select Generate and do the following

  Finally, a menu will come out through which to bind controls and events

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324928483&siteId=291194637