Eclipse cannot find Theme.Sherlock in ActionBarSherlock

This is copied directly from the question I asked in Google groups:

I'm having problems using ABS in Eclipse (Indigo). I am using ABS 4.1.0. I created a project from / library in Eclipse, set the build target to 14, from minSdk to 14, the Java compliance level to 1.6, as I was told. There are no errors in the ABS project, but in my own project, minSdk 7, targetSdk 14, build target 14 and ABS are added as a library, I get this error in AndroidManifest.xml:

Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.Sherlock') 

although I imported ABS.
In addition, R.java refuses to generate, so I also have a bunch of “R cannot be resolved by a variable” in my class. Are these two connected?

Please tell me if you need more information.
Help will be appreciated.

+4
source share
5 answers

Well, that certainly made me feel stupid. But now I can sleep well (such things always support me at night).

What caused my problem was simply that the library was not on the same drive as my workspace (respectively D: and C: respectively), so Eclipse was unable to create a relative path between them. I just moved the library to C: and it worked.

Thanks to this question that set me on the right track.

+2
source

In my case, lib was on a different hard drive (and not in the eclipse workspace). It worked after I moved the lib project to the workspace.

+2
source

1) Remove the library-4.0.0.jar and android-support-4.0.jar from the lib project directory (or delete the link). In my opinion, the setup guide is a bit unclear. The Android Support Library should be added to the ABS-Library-Project, and not to your project.

2) Try to clear both the library project and the implementation project. In addition, right-click each of the projects and select Android -> Fix project properties

3) Make sure that the “Is a library” checkbox on the “Properties → Android” screen of the library project is checked and the library project is added on this screen in the implementation project (and NOT as an external / Java library)

4) Try importing the “ABS Trial”, which can be downloaded from the ABS website to see if there is the same error.

5) In Java classes where you get errors related to "R cannot be resolved ...", make sure you import import com.yourcompany.yourapp.R; rather than ABS- R Fix all the errors you get (or just temporarily remove the code that throws the errors) so that your R file project can be generated properly. The error in the manifest should disappear after that.

+1
source

Try changing the target level of the API (both the ActionBarSherlock project and yours) to 15.

  • Update the manifest: android:targetSdkVersion="15" .
  • Change the build target to “Android 4.0.3” by right-clicking the project in Project Explorer and selecting Properties , clicking Android (in the left pane), and then select the checkbox corresponding to API 15.

Also, delete the reference library (the one that has the red X) and add it again. Now there should be a green check. Everything should work, I believe when you do it.

0
source

Finally, I find a solution:

  • IMPORTANT! Copy the same android-support-v4.jar file in both projects: to the library and your project (this is the main problem).
  • Import the library project into your work environment
  • Right-click on the library project Properties → Android → Check “Target Name” 4.x (any, API level 14.15 or 16). Bottom check "Library".
  • In the properties, go to the "Java Build Path", the "Libraries" tab and find "android-support-v4.jar" usually in "Android Dependencies". Ok and Close properties.
  • Right-click on the Android Tools library project → Fix Project Properties
  • from the menu Project → Clean ... and select to clear the Library project.

In this place your "library" of the project should be executed (without errors)

  • Create or import your own project. Example "MyProject"
  • In the properties, go to the "Java Build Path", the "Libraries" tab and find "android-support-v4.jar" usually in the "Android Dependency".
  • Now go to the Projects tab. Add ... and select the "library" project.
  • Now in the properties go to Android → Check "Target Name" 4.x (any, API level 14.15 or 16). IMPORTANT: Must be the same from the "library" project. The bottom "Library" should be UNCHECKED, and at this point click "Add ..." and select the "library" project. Properties Ok and Close.
  • Right-click on the MyProject project. Android Tools → Fix Project Properties.
  • in the menu Project → Clean ... and select clean project "MyProject".

Your project should already be completed. If the error persists, restart Eclipse.

0
source

All Articles