完美解决 Attribute “titleTextStyle” has already been defined

来源:互联网 发布:中科恒运大数据 编辑:程序博客网 时间:2024/05/17 23:12

问题出现原因

在Android Studio中准备引入Eclipse中的项目,而此项目中包含了第三方库actionbarsherlock,是一个作者不再维护的库。在我把此项目引入到Android Studio中编译时,提示了”Attribute “titleTextStyle” has already been defined” 这样的错误。

因为我是在Android Studio中新建了一个module,然后再把actionbarsherlock里面的资源和代码放进新的module中的。
新建的module中的build.gradle中默认带有
com.android.support:appcompat-v7:23.4.0

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.4.0'}

就是因为此导入的库和actionbarsherlock中的attr属性有冲突导致的。


解决问题方法

删掉 com.android.support:appcompat-v7:23.4.0 ,
改为:com.google.android.gms:play-services:7.0.0
如:

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.google.android.gms:play-services:7.0.0'}

重新clear项目后,再编译就可以解决此问题啦

1 0