Eclipse不产生黄油刀的.apt_generated文件夹 [英] Eclipse doesn't generate the .apt_generated folder for Butter Knife

查看:5441
本文介绍了Eclipse不产生黄油刀的.apt_generated文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经仔细遵循官方指南使注释在我的Eclipse ADT 3.8的说明。

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:

我的Andr​​oid应用程序编译成功。它运行得,当然,但我得到明显的NPE的原因在于预期由黄油刀住宿初始化意见

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.

如果我更改生成配置,比如 .apt_generated_foo_bar ,Eclipse将创建该文件夹。而空。

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

我如何能说服Eclipse创建在 .apt_generated

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

推荐答案

这个问题(和答案)复制这一个:<一href=\"http://stackoverflow.com/questions/23288054/butterknife-does-not-create-anything-in-apt-generated-directory/26036084\">Butterknife不创建.apt_generated目录什么

This question (and answer) duplicates this one: Butterknife does not create anything in .apt_generated directory

首先,你需要确保你有一个的Andr​​oid 的项目,而不是一个的Andr​​oid库项目,因为奶油刀不支持库项目。要做到这一点点击项目属性并转到的Andr​​oid 部分。确保是库复选框没有被点击。有关详细信息,请参阅:

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

然后在检查这些设置的项目/ .factorypath 的:

Then check these settings in project/.factorypath:

<factorypath>
    <factorypathentry kind="WKSPJAR" id="/PotlatchClient/libs/butterknife-5.1.2.jar" enabled="true" runInBatchMode="false"/>
</factorypath>

项目/ .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

项目/ .settings / org.eclipse.jdt.core preFS 的:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.processAnnotations=enabled

终于不用在Eclipse中刷新和清洁做一个完整的重建。

Finally do a refresh in Eclipse and clean to do a full rebuild.

与其他的建议是改变了JDK 1.7的问题,也就是说你只能针对奇巧(4.4)或更高版本。

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

这篇关于Eclipse不产生黄油刀的.apt_generated文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆