4

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.

vurp0
  • 1,035
  • 2
  • 9
  • 13
  • Why are you using ActionBarSherlock if your app has a minimum sdk version of 14? Can't you just use the regular `ActionBar`?! – Alex Lockwood Jun 15 '12 at 23:35
  • ABS(library) has a minimum sdk of 14, and the project itself(app) has a minimum sdk of 7, as I've been told. – vurp0 Jun 15 '12 at 23:47
  • I also found that when I look in the samples' properties, there's a green checkmark next to the ABS library, but in my project's properties, there's a red X next to the library. – vurp0 Jun 15 '12 at 23:54
  • I think, based on [this](http://stackoverflow.com/questions/10200751/eclipse-will-not-recognize-project-as-library-actionbarsherlock-viewpagerindica) link that it's caused by me keeping the library and workspace on different drives(C: and D:). This was probably stupid of me. I'll move the library and see what happens. – vurp0 Jun 16 '12 at 00:02

5 Answers5

2

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.

Community
  • 1
  • 1
vurp0
  • 1,035
  • 2
  • 9
  • 13
2

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.

Tyler Durden
  • 11,156
  • 9
  • 64
  • 126
Stepper
  • 21
  • 2
1

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.

Nick
  • 3,504
  • 2
  • 39
  • 78
  • This didn't help. :( Also, there was no library-4.0.0.jar in /lib. Should there have been? – vurp0 Jun 15 '12 at 20:02
  • I've updated my original answer with some additional suggestions – Nick Jun 15 '12 at 20:32
  • Yes, ABS is added as a library project and ABS has "Is Library" checked. But the sample doesn't give any errors at all! – vurp0 Jun 15 '12 at 23:14
  • I think it's related to the "R cannot be resolved"-error. I've updated my answer once more :-)! – Nick Jun 15 '12 at 23:21
  • You're supposed to import R? The samples don't do it, but I'll try anything that could work. – vurp0 Jun 15 '12 at 23:29
  • I tried commenting out every line that threw the R error, but it didn't work. What I did was: comment out every line with "R", save, project>clean. Should I do something else? – vurp0 Jun 15 '12 at 23:35
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/12627/discussion-between-vurp0-and-nick) – vurp0 Jun 15 '12 at 23:39
0

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.

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
  • This didn't help, unfortunately. – vurp0 Jun 15 '12 at 23:51
  • well it was worth a shot. I know for a fact that you need to build your project against API 15, however... Jake Wharton said so (I forget where... but trust me, he said it :P). – Alex Lockwood Jun 16 '12 at 00:09
  • @vurp, check my post again. Red X's are bad... remove the library and then re-add it (browse to the `library` folder and click add). There should be a green check now, and I believe it will work. – Alex Lockwood Jun 16 '12 at 00:11
  • Already solved it. Keeping the library and workspace on separate drives was a bad idea. – vurp0 Jun 16 '12 at 00:19
0

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.

German Tamayo
  • 301
  • 1
  • 3
  • 8