Home » Android » android – AndroidAnnotations cannot find symbol class

android – AndroidAnnotations cannot find symbol class

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m using AndroidAnnotations in an Android Studio gradle project. I currently get error output from AA during compilation that says:

cannot find symbol class MyActivity_

The error output does not prevent building the application – its not really a compile error because the class is there, it seems that it is just an unfortunate timing issue with the compilation process.

Is there anything I can do to avoid these false-positive errors from AA? When there are “fake” errors shown every time I compile, its very easy to miss the real errors.

How to&Answers:

I had same error. To solve it I have revert my last changes and it has worked again.
I think it was either wrong optimized import(you must import generated classes eg. xxx_) or I injected layout by id what was not existed in the layout xml

Update

I figured it. My problem was what I had use private mofidier instead of proteced in

@ViewById(R.id.list) 
private ListView list;

Answer:

Try to see if you missed to fix some errors in the class MainActivity or in someone of his Bean member that you have annoted.

Answer:

The problem doesn’t have to be in MainActivty, but it is probably because of a private modifier which is used with Android Anotations (in injection, method declaration etc) somewhere in your code