2015-11-04 29 views
1

我的搖籃依賴包括:不止一個庫包名

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

我得到BUILD失敗,錯誤:

Error:Execution failed for task ':app: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

我怎樣才能解決這個問題?

回答

1

使用gradle androidDependencies可以瞭解重複的Google Play服務來自何處。然後使用exclude來篩選Gradle依賴項中的重複項,例如

compile('something.that.includes.google.play.services:1.2.3') { 
    exclude group: 'com.google.android.gms' 
} 
-2

最簡單的方法是全包替換這些依賴關係:

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

那麼你也許可以編譯它。

或在您的build.gradle中添加android.enforceUniquePackageName = false

android { 

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) 
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION 

    defaultConfig { 
     minSdkVersion 9 
     targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) 
     versionCode Integer.parseInt(project.VERSION_CODE) 
     versionName project.VERSION_NAME 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 

    android.packageBuildConfig = false 
    android.enforceUniquePackageName = false 

} 
+0

沒關係,但我不想從play-services加載所有庫。因爲multiDex :( – anilst

+0

是你所有的gradle依賴關係嗎? – Nawako

+0

不,我有18個以上的 – anilst

相關問題