vurp0
vurp0

Reputation: 1035

Eclipse can't find Theme.Sherlock in ActionBarSherlock

This is copied straight from a question I asked on Google Groups:

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

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

even though I've imported ABS.
Also, R.java refuses to generate, so I also have a bunch of "R cannot be resolved to a variable" in my class. Are the two related?

Please tell me if you need more info.
Help would be appreciated.

Upvotes: 4

Views: 3919

Answers (5)

German Tamayo
German Tamayo

Reputation: 301

I finally find the solution:

  1. IMPORTANT! Copy the same android-support-v4.jar in both projects: in library and your project (this is the principal problem).
  2. Import "library" project TO YOUR WORKSPACE
  3. Right click on library project Properties -> Android -> Check "Target Name" 4.x (any, API level 14,15 or 16). Bottom check "Is library".
  4. In properties, go to "Java Build Path", tab "Libraries" And find "android-support-v4.jar" normally in "Android Dependencies". Ok and Close Properties.
  5. Right click on library project Android Tools -> Fix Project Properties
  6. in Menu Project -> Clean... and select to clean the "Library" Project.

In this place, your project "library" must to be done (without errors)

  1. Create or import your own project. Example "MyProject"
  2. In properties, go to "Java Build Path", tab "Libraries" And find "android-support-v4.jar" normally in "Android Dependencies".
  3. Now go to "Projects" Tab. Add... and select "library" project.
  4. Now in properties go to Android -> Check "Target Name" 4.x (any, API level 14,15 or 16). IMPORTANT: Must to be the same of "library" project. Bottom "Is Library" must to be UNCHECKED and in this place press Add... And select "library" project. Ok and Close properties.
  5. Right click on "MyProject" project Android Tools -> Fix Project Properties
  6. in Menu Project -> Clean... and select to clean the "MyProject" Project.

Already, your project must to be done. If the error persist, restart Eclipse.

Upvotes: 0

Stepper
Stepper

Reputation: 21

In my case the lib was on another harddisk (not in the eclipse workspace). It worked after I moved the lib-project into the work-space.

Upvotes: 2

vurp0
vurp0

Reputation: 1035

Well, that certainly made me feel stupid. But now I can sleep well(things like these always keep me up at night).

What caused my problem was simply that the library wasn't on the same drive as my workspace(D: and C:, respectively), so Eclipse couldn't create a relative path between the two. I simply moved the library to C: and it worked.

Thanks to this question that put me on the right path.

Upvotes: 2

Alex Lockwood
Alex Lockwood

Reputation: 83311

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

  1. Update your manifest: android:targetSdkVersion="15".
  2. Change the build target to "Android 4.0.3" by right clicking your project in the Project Explorer and selecting Properties, clicking Android (in the left panel), and then checking the check box corresponding to API 15.

Also, remove the referenced library (the one with the red X) and re-add it again. There should now be a green check. Everything should work I believe once you do this.

Upvotes: 0

Nick
Nick

Reputation: 3494

1) Remove library-4.0.0.jar and android-support-4.0.jar from your project's lib directory (or un-link it). The setup-guide is a bit unclear on this, in my opinion. The android-support-library only needs to be added to the ABS-Library-Project, not your project.

2) Try cleaning both your Library Project and your implementation project. In addition, right-click each of the projects and select Android --> Fix project properties

3) Check that the "Is Library"-checkbox on the Properties-->Android screen of the Library Project is checked, and that you've added the library project on this screen in the implementation-project (and NOT as an external/Java-library)

4) Try importing the "ABS Sample Project" that can be downloaded from the ABS website to see if you get the same error there.

5) In the Java-classes where you get errors relating to "R cannot be resolved...", check that you're importing import com.yourcompany.yourapp.R; rather than the ABS-R. Fix any errors that you're getting there (or simply temporarily remove the code that is throwing errors) so that your project's R-file can be generated properly. The error in the manifest should go away afterwards.

Upvotes: 1

Related Questions