关于Unable to load annotation processor factory 的故障

导入一个项目的时候,如果提醒以下错误,可参考https://github.com/excilys/androidannotations/wiki/Eclipse-only-configuration进行排错:

Description Resource Path Location Type
Unable to load annotation processor factory 'package-name-xxxxxe--.0.0.jar' for project project-name Annotation processor factory path APT Build Problem

https://github.com/excilys/androidannotations/wiki/Eclipse-only-configuration 的具体步骤:

Eclipse only configuration

Note

Configuring Eclipse

Please note that there are two important JARs in AndroidAnnotations:

  • androidannotations-X.X.X-api.jar is the API JAR, it must be in your build path and will be part of the final APK
  • androidannotations-X.X.X.jar is the processor JAR, it is only needed at compile time, and must be in the compiler classpath.

Steps

  1. Put androidannotations-X.X.X-api.jar in the libs folder
  2. Put androidannotations-X.X.X.jar in a different folder, such as compile-libs. androidannotations-X.X.X.jar must not go in the libs folder.(注意,jar包不能放到lib文件夹或其子目录)
  3. Right-click on your project, choose "Properties"
  4. Go to Java Compiler and make sure that Compiler compliance level is set to 1.6, otherwise the processor won't be activated
  5. Go to Java Compiler > Annotation Processing and choose Enable annotation processing
  6. Go to Java Compiler > Annotation Processing > Factory Path and add the processor JAR : androidannotations-X.X.X.jar.
  7. Confirm the workspace rebuild
  8. Go to Java Build Path > Libraries and add the API JAR : androidannotations-X.X.X-api.jar, unless it's already in the build path (ADT 17 automatically adds JARs that are in the libs folder).
  9. You can start using AndroidAnnotations

Troubleshooting

  • To check that AndroidAnnotations is activated, you should see AndroidAnnotations logs in the Eclipse Error Log (Window > Show View > Error Log) as soon as you save a file. If you do not see any log here, then it means AndroidAnnotations isn't activated yet.

  • If AndroidAnnotations isn't activated, this may be a Java version problem. You should check that eclipse.ini doesn't contain -Dosgi.requiredJavaVersion=1.5, and otherwise change it to -Dosgi.requiredJavaVersion=1.6.

  • When AndroidAnnotations is activated, You should now see any annotation problem as a regular error marker within the editor and in the Problem view.

  • Your project name should be identical to the name of the folder containing the project. When importing a project in Eclipse, the project name used is the name of the folder. Since the annotation jar is referenced by projectName/lib/androidannotations-X.X.X.jar, you may otherwise encounter errors when coworkers import your project.

  • If you get a java.lang.IllegalArgumentException: already added: Lorg/androidannotations/annotations/AfterInject; when compiling, please check that you did not put the processor jar androidannotations-X.X.X.jar in the libs folder.

  • If you get a java.lang.NoClassDefFoundError at runtime, please verify in project properties > Java Build Path > Order and Export that androidannotations-xxx-api.jar is checked.

Next step

转载于:https://my.oschina.net/reborn87/blog/415716

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值