问题
I am trying to use Butterknife for injection, but I do not see any classes generated in the .apt_generated directory.
I am using eclipse Kepler (service release 2), enabled annotation processing in my project properties and defined the butterknife-5.0.0.jar as the annotation processor in the factory path.
I have 2 views injected into a fragment for testing, and when I clean the project it is built but nothing is generated. Checking the log file and the error_log view I don't see anything related..
Any ideas?
回答1:
I suggest to check if you compile and run your app.
Or, other parts of your codes may have some errors and the IDE isn't able to build. e.g R.java is missing etc.
回答2:
First you need to make sure you have an Android project and not an Android library project because Butterknife does not support library projects. To do this click Project Properties
and go to the Android
section. Make sure the is Library
checkbox is not clicked. For further details see:
- https://github.com/JakeWharton/butterknife/issues/2
- http://developer.android.com/tools/projects/projects-eclipse.htm
Then check these settings in project/.factorypath:
<factorypath>
<factorypathentry kind="WKSPJAR" id="/PotlatchClient/libs/butterknife-5.1.2.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
project/.settings/org.eclipse.jdt.apt.core.prefs:
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.reconcileEnabled=true
project/.settings/org.eclipse.jdt.core.prefs:
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.processAnnotations=enabled
Finally do a refresh in Eclipse and clean to do a full rebuild.
来源:https://stackoverflow.com/questions/23288054/butterknife-does-not-create-anything-in-apt-generated-directory