aspose file tools*
The moose likes Android and the fly likes IJ 11 + Android + ActionBarSherlock not recognizing R.java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "IJ 11 + Android + ActionBarSherlock not recognizing R.java" Watch "IJ 11 + Android + ActionBarSherlock not recognizing R.java" New topic
Author

IJ 11 + Android + ActionBarSherlock not recognizing R.java

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

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

Joined: Jan 03, 2004
Posts: 6109
    
    6

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

Joined: Jan 03, 2004
Posts: 6109
    
    6

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

Joined: Feb 24, 2006
Posts: 6662
    
    5

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.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IJ 11 + Android + ActionBarSherlock not recognizing R.java