java黄油刀,Eclipse不产生黄油刀的.apt_generated文件夹

I have carefully followed the instructions in the official guide to enable annotations in my Eclipse ADT 3.8.

That is, Annotation Processing and Factory Path are properly configured:

ZFNJr.png

5REh8.png

My Android application compiles successfully. It runs too, of course, but I get obvious NPEs due to views that are expected to be initialized by Butter Knife stay null.

If I change the configuration to generate, say .apt_generated_foo_bar, Eclipse will create that folder. But empty.

Any ideas on how I can convince Eclipse to create the appropriate classes in .apt_generated?

解决方案

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:

Then check these settings in project/.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.

The problem with the other suggestion is changing the JDK to 1.7 means you can only target Kitkat (4.4) or higher.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值