Using Butter Knife library for view injection

巧了我就是萌 提交于 2019-11-29 00:15:25
nitesh

Follow this Steps [ into Eclipse IDE ]:

1)Right click on your project withIn Package Explorer. Got to Java Compiler --> Annotation Processing and check the Enable project specific settings.

2)Expand the Annotation Processing section and select Factory Path. Check Enable project specific settings and then click Add JARs Navigate to the project's libs/ folder and select the ButterKnife jar.

3)Click Ok to save the new settings. Eclipse will ask you to rebuild your project to which you should click Yes.

Note: Make sure that the .apt_generated/ folder is in your project root. It should contain files like YOURACTIVITY$$ViewInjector.java. If these files are not present trigger a clean build by selected Project → Clean. This folder and files should not be checked into revision control.

Reference -> Set up manual configuration for ButterKnife annotations

IntelliJ IDEA — If your project uses an external configuration (like a Maven pom.xml) then annotation processing should just work.

Follow these steps :

  1. Open IDEA's preference: File -> Other Settings -> Default Settings
  2. Navigate to Compiler -> Annotation Processors Then Check Enable annotation processing

Reference -> Set up manual configuration for ButterKnife annotations

Update 30-6-2015

Follow These Steps for Intellij IDEA 14.0 :

  1. Open IDEA's preference: File -> Settings or click ctl + alt + s

  2. Navigate to Build, Execution and deployment -> Compiler -> Annotation Processors and Choose your project Then Check Enable annotation processing

@Bind replaces @InjectView and @InjectViews. ButterKnife.bind and ButterKnife.unbind replaces ButterKnife.inject and ButterKnife.reset, respectively.

look at this : @InjectView replaced ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!