Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IJ 11 + Android + ActionBarSherlock not recognizing R.java

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not new to Java or to IntelliJ, but brand new to Android development.

I've inherited a project from a develoer who used eclipse, created the IJ project from the eclipse projects.

Directory structure is:
Main
Main/lib/ActionBarSherlock
...

where Main and ActionBarSherlock are both eclipse project roots. It builds fine in eclipse.

My IJ modules are, accordingly, Main and Main/lib/ActionBarSherlock.

When I go to build the project or the ABS module inside IJ, on various ABS classes, the compile fails and in the messages, I get "cannot find symbol R" on a import com.actionbarsherlock.R; statement. Here's the weird part: When I dtl-B on the R in the import or an any use of it in the classes, it's fine. The source file has no red squigglies, but the Build fails.

Whence the disconnect, and how do I fix it?

(Note that I don't currently have an Android Facet set up for the ABS module. I had it previously, but I got all kinds of complaints in the xml files.)

(I've crossposted this to http://devnet.jetbrains.net/thread/438871.)

Thanks in advance for any help!
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I take it back. Eclipse is not building either. It was before. I guess I'm going to have to assume that I screwed up a resource or something. I'll look into that. Sorry for the (probably) false alarm.

I take back my take-back. Undid my changes, eclipse is now fine, IJ still has the above problem.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, a combination of newer Android SDK version and adding an Adroid Facet fixed it. Not sure why I got that behavior in the first place though, and I do need to build against the lower version (which, again, does work in eclipse).
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I dtl-B on the R in the import or an any use of it in the classes, it's fine. The source file has no red squigglies, but the Build fails.


This can happen on a buggy eclipse for several reasons. Things to check

1. Is your project recognized by eclipse as an android project ?
2. Are there project builders configured that generate R.java correctly ?
3. Is Actionbarsherlock used as a binary library or an Android library project within the workspace ? Since R.java is generated, the library project will not generate R.java if there are build-path errors.

The version of the Android SDK should match the one mentioned on AndroidManifest.xml. I've not used IJ for developing on android so may be there is a quirk there that I dont know about.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic