jbenowitz
jbenowitz

Reputation: 1815

Cleaning ActionBarSherlock creates R cannot be resolved error

I've recently (this morning) updated a bunch of android plugins in my eclipse environment (so I could switch over to Android Studio), however, I decided to return to Eclipse to finish something up. I had to re-import the actionbarsherlock project (4.2.0 library). After I imported, made sure it was running on Android 4.2 and as a library, I cleaned the actionbarsherlock 'library' project. Which resulted in over 200 'R cannot be resolved to a variable' problem.

I've tried all the usual suspects: couldn't find any errors in the res file, tried cleaning, refreshing, closing eclipse in various different orders.

I'm also noticing a new dependency entitled "Android Private Libraries" -- I am not positive it is new from this update, but it could be.

Other information that might be useful: - there are no gen files (nothing is being generated) - I also linked it to my Android Project as a library (set to the same API level) - I've done separate cleans and a clean at once

Any help would be great, I'm stuck on this one and it's driving me nuts.

Upvotes: 4

Views: 2858

Answers (7)

Name is carl
Name is carl

Reputation: 6051

Strangely enough, this issue gets fixed when I add old flavors of Android SDK build tools: 18.x and 17.x

(For some reason, I uninstalled some of those)

enter image description here

Upvotes: 0

DiscDev
DiscDev

Reputation: 39052

Are you using the Android support library?

I had this error because I had a different version of the Android support library jar in ABS vs. the rest of my project. Make sure the support library jars you are using are identical in every project.

Upvotes: 0

jamesc
jamesc

Reputation: 12837

In my case I am running 64 bit Linux (Linux Mint) and I had to install 32 bit libraries using sudo apt-get install ia32-libs

After installing the 32 bit libraries I restarted eclipse and cleaned the ActionBarSherlock library and all is good

Upvotes: 0

Ton
Ton

Reputation: 9746

In my case I had the wrong Android target. To solve it: Right click on your project, then Properties, then click on Android and select the correct Project Build Target. I had Android 2.3.3 and I changed it to Android 4.2.2

I hope this helps to someone. enter image description here

Upvotes: 1

RRTW
RRTW

Reputation: 3190

This problem was stupid(I mean this situation)... and I was using a stupid way to solve it.

  1. update android API & SDK & anything else you can.
  2. Open your library project's Properties window, go to [Java Build Path], [Order and Export]
  3. Use [Up] [Down] button to make sort sequence like this:

enter image description here

After this, it still shows same error, so you have to re-build this single library project again.

  • Check top menu, [Project], [Clean...]
  • Clean that single library project, make it auto re-build.

That's how I solve all my library porject's same problem. (ActionBarSherlock, FacebookSDK, SlidingMenu, ViewPagerIndicator)

Sounds like a stupid solution, but just match this stupid situation.

Google, what the hell are you doing ?

Upvotes: 0

jbenowitz
jbenowitz

Reputation: 1815

Resolved by updating the API's as well as the tools and everything else I updated this morning. Very weird situation.

Upvotes: 1

Ahmad
Ahmad

Reputation: 72603

You have to check the Android Private Libraries in the java build path of the project:

enter image description here

Upvotes: 2

Related Questions