通过月食建匕首例如失败,'请确保code一代已运行此模块。“月食、匕首、模块、code

由网友(一纸虚无.)分享简介:我用匕首依赖注入在Android中,使用Eclipse来构建。我已经克隆 Android的活性图的使用例如,I'm using Dagger for dependency injection in Android, using Eclipse to build. I've cloned android-activi...

我用匕首依赖注入在Android中,使用Eclipse来构建。我已经克隆 Android的活性图的使用例如,

I'm using Dagger for dependency injection in Android, using Eclipse to build. I've cloned android-activity-graphs to use as an example.

我按的 staxgr 的从 HTTPS设置我的环境//github.com/square/dagger/issues/126 这些是我的库:​​匕首1.1.0.jar 的匕首编译-1.1.0.jar 和 javax.inject.jar 的

I've set up my environment according to staxgr from https://github.com/square/dagger/issues/126 These are my libs: dagger-1.1.0.jar, dagger-compiler-1.1.0.jar, and javax.inject.jar

最后,我已经改变了源文件夹在Eclipse中指向的src / main / java下(而不仅仅是的src / ),以便通过Eclipse的package关键字检测的相关文件。

And lastly, I've changed the source folders in Eclipse to point to src/main/java (instead of just src/) so that Eclipse detects the related files through the package keyword.

该项目建立,但是当它的运行与此异常立即失败:

The project builds, but fails immediately when it's run with this exception:

Caused by: java.lang.IllegalStateException: 
    Module adapter for class 
    com.example.dagger.activitygraphs.AndroidModule could not be loaded. 
    Please ensure that code generation was run for this module.

at dagger.internal.FailoverLoader.getModuleAdapter(FailoverLoader.java:41)
at dagger.internal.Modules.getAllModuleAdapters(Modules.java:43)
at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:167)
at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:134)
at dagger.ObjectGraph.create(ObjectGraph.java:126)
at com.example.dagger.activitygraphs.DemoApplication.onCreate(DemoApplication.java:29)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)

我如何匕首例子来工作,通过月食?

How do I get Dagger examples to work through eclipse?

推荐答案

现在的问题是我缺少的javawriter图书馆。此外,您必须使用javawriter的2.2.1版本,而不是它是2.3.0(这可能会改变,但在二○一三年十一月二十七日写这篇的时候仍是如此)的最新进展。所提供的链接应该带你到正确的位置。请仔细三重检查,共六次。我还包括其他原因的列表,为什么你可能会看到这条消息。

The problem is I am missing the javawriter library. Also, you MUST use version 2.2.1 of javawriter and NOT the latest which is 2.3.0 (this will probably change, but remains true at the time of writing this on 11/27/2013). The link provided should take you to the correct place. Please double triple check this, for a total of six times. I'll also include a list of other reasons why you might see this message.

首先,请确保所有这些复选框被选中。

First, please ensure that all these checkboxes are checked.

项目 - >属性 - > Java编译器 - >启用项目的具体设置

Project -> Properties ->Java Compiler -> Enable Project Specific Settings

项目 - >属性 - > Java编译器 - >注释处理 - >启用项目的具体设置

Project -> Properties ->Java Compiler -> Annotation Processing -> Enable Project Specific Settings

项目 - >属性 - > Java编译器 - >注释处理 - >工厂路径 - >启用项目的具体设置。

Project -> Properties ->Java Compiler -> Annotation Processing -> Factory path -> Enable Project Specific Settings.

然后在同一屏幕上,单击添加罐子,并添加:javawriter-2.2.1.jar,匕首-1.1.0.jar,匕首编译-1.1.0.jar和javax.inject.jar在这列出以及对于总共四个罐子

Then on the same screen, click "Add jars" and add: javawriter-2.2.1.jar, dagger-1.1.0.jar, dagger-compiler-1.1.0.jar and javax.inject.jar in this list as well for a total of four jars.

这四个罐子应该是一个叫做项目的主路径上的库文件夹中。

Those four jars should be in a folder called 'libs' on your project's main path.

如果您使用的是图书馆,并希望这些库使用匕首进行DI,你将不得不做上面的步骤对这些项目也是如此。

If you are using libraries and want to use Dagger for DI in those libraries, you will have to do the steps above on those projects as well.

阅读全文

相关推荐

最新文章