Android-Studio ActionBar sherlock error with gradl

2019-02-17 21:56发布

问题:

Though i have imported and added ActionBar Sherlock to my project, I am not able to compile the project. I get the following error:

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

How do I solve this?? Please help...

回答1:

There is some bug in Android Studio which doesn't handle library dependencies well while exporting gradle file. You can manually edit library dependencies by any one of the following method.

1) For instance, given to following structure:

MyProject/

  • app/
  • libraries/
    • lib1/
    • lib2/

We can identify 3 projects. Gradle will reference them with the following name:

  1. :app
  2. :libraries:lib1
  3. :libraries:lib2

The :app project is likely to depend on the libraries, and this is done by declaring the following dependencies:

dependencies {
    compile project(':libraries:lib1')
}

2) Or you do do File -> Project Structure -> Modules There you will find dependencies tab, Click on it and manually add libraries by pressing on "+" button.

For Sherlock, may be you want to delete their test directory, or add the junit.jar file to the classpath