我尝试使用Gradle将ActionBarSherlock(ABS)导入我的Android应用程序,但不幸的是,在构建时我收到错误列表:
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:248: error: Attribute "titleTextStyle" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:250: error: Attribute "subtitleTextStyle" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:256: error: Attribute "divider" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:258: error: Attribute "background" has already been defined
[etc. etc.]
* What went wrong:
Execution failed for task ':processDebugResources'.
> Could not call IncrementalTask.taskAction() on task ':processDebugResources'
我尝试使用 build.gradle 中的以下内容导入ABS:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services:4.0.30'
instrumentTestCompile(files('libs/espresso-1.0-SNAPSHOT-bundled.jar'))
}
在我的 settings.gradle 中,我得到以下内容:
include ':OurPackage', ':Libraries:ActionBarSherlock'
有人知道我做错了什么吗?欢迎所有提示!
答案 0 :(得分:0)
您要添加两次相同的库。
从maven作为aar格式
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}
从本地副本
include ':OurPackage', ':Libraries:ActionBarSherlock'
您必须删除本地副本,因为这样您可以两次添加相同的样式和名称相同的attrs。