更新播放服务会出现重复的资源错误

Updating play-services gives repeated resources error

我想使用来自 Google Play Services 的新 Google Cloud Messaging 的 InstanceID,为此我需要更新我的 play-services 库。 这是我对当前版本 build.dragle 的依赖:

dependencies {
compile 'com.google.android.gms:play-services:6.1.+'

compile 'com.android.support:support-v4:23.1.+'
compile project(':slidingMenuLibrary')
compile 'joda-time:joda-time:2.6'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile files('libs/GraphView-3.1.1.jar')
compile files('libs/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar')
compile files('libs/libphonenumber-7.0.1.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-android-4.46.jar')
compile files('libs/ormlite-core-4.46.jar')
compile files('libs/ormlite-jdbc-4.46.jar')
}

这里是来自 slidingMenuLibrary 的build.dragle

dependencies {
compile 'com.android.support:support-v4:23.1.+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}

我将 Android SDK 管理器上的 Google Play 服务更新到最新版本。但是当我将 compile 'com.google.android.gms:play-services:6.1.+' 更改为 compile 'com.google.android.gms:play-services:8.1.0' 时,Android Studio 给出了错误列表:

Error:(1) Attribute "titleTextStyle" has already been defined
C:\Users\Rui\AndroidStudioProjects\tk-main-    repository\tkAndroid\src\main\res\values\colors.xml
Error:(1) Attribute "subtitleTextStyle" has already been defined
Error:(1) Attribute "divider" has already been defined
Error:(1) Attribute "background" has already been defined
Error:(1) Attribute "backgroundSplit" has already been defined
...

当我改回 play-services:6.1.+' 时,所有错误都消失了。 我知道我有重复的属性,但我不明白在哪里可以更改它们,或者如何解决这个问题...

有什么建议吗?

不再推荐使用完整的播放服务依赖。相反,您应该使用所需的个人依赖项。

对于 GCM 使用:

compile 'com.google.android.gms:play-services-gcm:8.1.0'

完整列表请参阅 this document 中的 Table 1。