2015-12-08 34 views
-1

我正在使用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'

+0

@MD感謝您提出這個問題,但正如我所知,通過編碼build.gradle,導入google_play_services.jar不是必需的不是嗎? – LKM

回答

1

你只需要添加

classpath 'com.google.gms:google-services:1.5.0-beta2' 

project-level build.gradle

,並添加

compile "com.google.android.gms:play-services:8.3.0" 

app-level build.gradle

檢查official docs它說什麼

0

com.kakao.sdk:push:1.1.0對com.google.android.gms:play-services:6.5.87有依賴關係,它與您聲明的com依賴關係衝突。 google.android.gms:play-services:8.3.0

您可以使用gradlew app:dependencies來檢查build.gradle文件的依賴關係樹。

相關問題