ActionBarSherlock - The type android.support.v4.app.Fragment cannot be resolved. It is indirectly referenced from required .class files

Solution 1:

I had the same problem as you since I had updated the SDK. I have solved my problem by doing this (on eclipse) :

  • Right click on the action bar sherlock library => Properties => Java Build Path => Order and Export tab => check android support v4 or Android Private Libraries and select Ok
  • Right click on your personal project and go to properties => java build path => check Android Private Libraries
  • Clean both projects, it should work.

Solution 2:

Sebastien's answer actually led me to the solution. However, it is important to mention that the support library has to be added manually to the build path in order to be able to check it for exporting. For future reference, here are the steps that solved the problem for me:

  1. Make sure the support library is in the libs folder of the ABS project and nowhere else
  2. Right-click on the library --> Build path --> Add to build path
  3. Right-click on ABS project --> Properties --> Java Build Path --> Order and Export --> Check the android-support-v4.jar file and save
  4. Right-click on the project where you have included ABS --> Properties --> Java Build Path --> Order and Export --> Check the "Android Private Libraries" and save
  5. If you have additional projects in your dependency hierarchy, do step 4 for all of this projects
  6. Clean the entire workspace (or all affected projects) and hope the best.

However, it is a mystery for me why this has to be so complicated - as Josh mentioned, Eclipse in combination with Android and large projects with a couple of dependencies is hard to use and I hope this will be improved in near future.

Solution 3:

In my case I'm using 2 Android libraries which require the android support library. The problem was that both libraries had different versions of the Android support library.

To resolve the issue: Right click on the library project => Android Tools => Add Support Library.

Repeat this action for each library.

Solution 4:

I had same problem. There were 2 different libraries. Delete support library from your main project

Solution 5:

Here is simplest solution:

Right click on your project folder -> Build path -> Configure build path -> Add External Jars(From libraries tab) -> select "android-support-v4.jar" file.

(It'll be located in Android SDK folder here is generic path "android-sdk\extras\android\support\v4").

After this clean you project and happy coding...