【发布时间】:2014-07-17 04:48:27
【问题描述】:
我使用的是 Android Studio 0.8.2,并使用 Android 4.1 和 Android Wear 4.4 创建了一个项目。我需要将它与 Google Play 服务集成。
我正在尝试在此处关注 Android Studio 的 Google Play 服务设置页面: https://developer.android.com/google/play-services/setup.html
在第 2 步中,它说要添加此依赖项:
compile 'com.google.android.gms:play-services:5.0.77'
但是,在同步时,我收到以下消息:
Error:Execution failed for task ':mobile:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
这是我在移动模块中的完整 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.OptimizedPrime.locationweartabs"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.google.android.gms:play-services:5.0.77'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:19.+'
}
似乎推荐的依赖与可穿戴编译语句冲突。我确实想保留对可穿戴设备的支持,同时需要 Google Play 服务。我该如何解决这个问题?
【问题讨论】:
-
其中一个库是否可能依赖于另一个库?可能存在传递依赖,所以不需要添加。
-
这个答案有很大帮助:stackoverflow.com/a/37772331/2371425。您需要确保没有导入多个
com.google.android.gmss。
标签: gradle android-studio wear-os