Can't reference R class on Android Maven project

When rebuilding my project IntelliJ IDEA generates the updated R class, although I can't use it. Why?I need to use it to reference one of my activities from R.layout. Can you help me?I'm using IntelliJ IDEA 12.
0
7 comments
Avatar
Permanently deleted user

Please provide more details. What do you mean by "can't use it"?

0
Avatar
Permanently deleted user

The main package for my project is br.com.remote, my Android Activities are inside the br.com.remote.activities package, then when I try to use R.menu.main_menu from one of the activities (the main_menu resource file exists) it can't find the R class inside the current package (br.com.remote.activities) and neither in the main package. It keeps trying to use the Android.R class which is not the one that I need.

0
Avatar
Permanently deleted user

Check if R class exists ( Navigate | Class ). If it does, try to type full reference like br.com.remote.R in your code.

0
Avatar
Permanently deleted user

It doesn't exist.


0
Avatar
Permanently deleted user

Coluld you please check following:
Go to Project Structure | Modules | choose Android facet to open facet settings. Then open "Compiler" tab. Is "Run 'process-resources' Maven task before Make" selected? I did manage to reproduce the problem in such case only.

0
Avatar
Permanently deleted user

Exactly what I needed.
Thank you

0
Avatar
Permanently deleted user

I've created a bug report in the tracker: http://youtrack.jetbrains.com/issue/IDEA-97686 , please vote. BTW if "external make" mode is enabled (by default in IDEA 12, it is) processing resources by Maven is not used anymore: R.java is generated by the IDE anyway.

0

Please sign in to leave a comment.