简体   繁体   English

Android-Studio ActionBar sherlock错误与gradle

[英]Android-Studio ActionBar sherlock error with gradle

Though i have imported and added ActionBar Sherlock to my project, I am not able to compile the project. 虽然我已将ActionBar Sherlock导入并添加到我的项目中,但我无法编译该项目。 I get the following error: 我收到以下错误:

Gradle: No resource found that matches the given name (at 'theme' with value '@style/Theme.Sherlock'). Gradle:找不到与给定名称匹配的资源(在'theme'处,值为'@ style / Theme.Sherlock')。

How do I solve this?? 我该如何解决这个问题? Please help... 请帮忙...

There is some bug in Android Studio which doesn't handle library dependencies well while exporting gradle file. Android Studio中存在一些错误,它在导出gradle文件时无法很好地处理库依赖项。 You can manually edit library dependencies by any one of the following method. 您可以通过以下任一方法手动编辑库依赖项。

1) For instance, given to following structure: 1)例如,给出以下结构:

MyProject/ 我的项目/

  • app/ 应用程序/
  • libraries/ 库/
    • lib1/ LIB1 /
    • lib2/ LIB2 /

We can identify 3 projects. 我们可以确定3个项目。 Gradle will reference them with the following name: Gradle将使用以下名称引用它们:

  1. :app :应用程序
  2. :libraries:lib1 :库:LIB1
  3. :libraries:lib2 :库:LIB2

The :app project is likely to depend on the libraries, and this is done by declaring the following dependencies: :app项目可能依赖于库,这是通过声明以下依赖项来完成的:

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. 2)或者您执行文件 - >项目结构 - >模块在那里您将找到依赖项选项卡,单击它并通过按“+”按钮手动添加库。

For Sherlock, may be you want to delete their test directory, or add the junit.jar file to the classpath 对于Sherlock,可能是您要删除其测试目录,或将junit.jar文件添加到类路径中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM