我正在使用GCM并设置与Google示例项目几乎相同。这是的build.gradle下面雷:Android-Gradle错误“多个库名称为com.google.android.gms”
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
subprojects {
repositories {
mavenCentral()
maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
}
}
而另一家的build.gradle下面是:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.min.photozzle"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:appcompat-v7:23.0.0'
// Testing dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support:support-annotations:23.0.0'
compile group: 'com.kakao.sdk', name: 'kakaolink', version: '1.1.0'
compile group: 'com.kakao.sdk', name: 'kakaostory', version: '1.1.0'// 카카오스토리 sdk를 사용하기 위해 필요.
compile group: 'com.kakao.sdk', name: 'kakaotalk', version: '1.1.0' // 카카오톡 sdk를 사용하기 위해 필요.
compile group: 'com.kakao.sdk', name: 'push', version: '1.1.0' // push sdk를 사용하기 위해 필요.
compile 'com.squareup.retrofit:retrofit:1.9.0'
}
没有定制我们的应用程序,由谷歌提供GCM的样本项目需要一些点,我的项目的build.gradle几乎相同。但样本项目运作良好,但我的项目说:
'Error: more than one library with package name 'com.google.android.gms'
@MD感谢您提出这个问题,但正如我所知,通过编码build.gradle,导入google_play_services.jar不是必需的不是吗? – LKM