Android Annotations: Annotated class Xyz_ not finding it's original ("cannot find symbol class Xyz")
Asked Answered
C

4

13

I use the latest Android Annotations 2.6 and IntelliJ IDEA. Sometimes I always keep having problem with the annotations / classpath / compilation order. Seems to occur irregularly. I had the project compile earlier today, then changed a res/layout-xml file later on, then I try to build the project and get an error.

But there are no syntax errors or anything in the xml nor java source files.

Problem is that the annotated class doesn't find it's original class, getting

cannot find symbol class Intro

error.

My project structure:

/src/
    /app/activity/Intro
    ...
/gen-annotation-processed/
    /app/activity/Intro_
    ...
/gen
    ...

My IDEA annotation preferences:

Processor path:

/path/to/project/ext-libs/androidannotations-2.6.jar

Processor FQ Name:

com.googlecode.androidannotations.AndroidAnnotationProcessor

Source folders in the project's Android IDEA module:

gen
gen-annotation-processed
src

enter image description here

Error login in IDEA when building the project (via IDEA, no ant or maven):

enter image description here

(Class "Intro" exists in the src folder and has no errors in it.)

Update: I have it working now, although not sure what/where I changed something after playing around with settings back and forth. It might actually just be an issue with IDEA and not actually android-annotations related, not sure yet.

What usually seems to work is: do a Rebuild (might throw compile errors, ignore). Then do a Build (not a complete rebuild). For some reasons, the multiple compilation runs don't work properly when doing a rebuild, need to do the rebuild+build combination.

Cargile answered 14/9, 2012 at 2:32 Comment(1)
It can be indeed IntelliJ IDEA problem, annotation processing configuration has been rewritten from scratch for IDEA 12 and should work better.Rubetta
C
5

Above mentioned problem was an issue with the new build system that was introduced with IDEA 12, in combination with an issue of AA 2.x, which is meanwhile fixed in AA 3.

See:

(Anyhow, as @outlying mentioned, maven is a good idea in general to make it independent of the IDE at all.)

Cargile answered 22/2, 2013 at 14:25 Comment(1)
I'm still seeing the problem. IntelliJ 12.1.4 and AA 3 (from the link above). Still seeing the same error. Used to be intermittent, but is now permanent. Incredibly frustrating. Will post to their issue tracker.Dougall
A
3

Have you tried this link http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/ ?

It works like a charm for me, I was able to setup few projects with AA on IDEA

Autunite answered 22/2, 2013 at 14:7 Comment(1)
Yes, meanwhile I'm also using maven as well, however, above seems to been a problem with the new build system that was introduced with IDEA 12, in combination with an issue of AA 2.x, which is fixed in AA 3. github.com/excilys/androidannotations/issues/423 and github.com/excilys/androidannotations/issues/471Cargile
W
0

You have to enable android annotation processing on File->Other Settings->Default Settings..

enter image description here

Wolf answered 12/10, 2015 at 10:58 Comment(1)
The checkbox was already checked. See accepted answer, it was a bug in the AndroidAnnotations project (back in 2013, already fixed in all newer versions).Cargile
P
-1
goto of your app build.gradle
and remove 

apt "org.androidannotations:androidannotations:{xxx}" compile 'org.androidannotations:androidannotations-api:{xxx}'
then put it again apt "org.androidannotations:androidannotations:{xxx}" compile 'org.androidannotations:androidannotations-api:{xxx}'
and rebuild
it worked for me
Penza answered 28/11, 2014 at 3:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.