ClassNotFoundException using AndroidAnnotations

本秂侑毒 提交于 2019-12-04 09:09:06

It looks like your AndroindAnnotation generated classes are not getting included in your build. Here are the lines your .classpath seems to be missing --

   <classpathentry kind="src" path=".apt_generated">
               <attributes>
                       <attribute name="optional" value="true"/>
               </attributes>
   </classpathentry>

These should have been generated for you as part of following the AndroidAnnotations install. Things to check --

  • Your ADT tools are up to date.

  • You ran Project->Clean after enabling annotations

I was able to clone your repo, import into eclipse, and get a clean build and run the app without a crash using the following steps --

  1. Refactor/rename project to TestAnnotations (eclipse imported as "MainActivity_")
  2. Enable annotation processing (needed to turn on Enable project specific settings and Enable annonation processing in `Java Compiler->Annontation Processing)
  3. Project->Clean
  4. Run it

Note: If I did an import and just refactored to get a clean build, but did not enable annotation processing, I got the exact same behavior you describe. Check to make sure you have project specific settings on, annotations on, and then do a clean build.

With maven and eclipse updating project configuration causes android annotation output folder get changed. To fix it go to java build path>Source and set the android annotation folder's output to default output folder.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!