Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android dependency issue with gms play services

I'm receiving an error due to the fact I'm attempting to use the app indexing library from Google while also importing a library which uses an older version of the android gms library for a different component - the cast library from Google Play services. The error states " All com.google.android.gms libraries must use the exact same version specification(mixing versions can lead to runtine crashes). Found versions 8.30,7.80. Examples include com.google.android.gms:play-servics-appindexing:8.3.0 and com.google.android.gms:play-services-cast:7.8.0. Not sure how to fix this as I cannot update the version used in the connectsdk I'm importing and I require version 8.3.0 for app indexing. My gradle files are as follows:

Module

android {

compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'

defaultConfig {
    applicationId xxx.xxx.xxx.xxx"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 10005
    versionName "1.0.5"
    multiDexEnabled true
}

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


dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/commons-lang3-3.3.2.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile ('com.connectsdk:connect-sdk-android:1.6.+')

**Project**:

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.google.gms:google-services:1.5.0-beta2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    }

allprojects {
    repositories {
        jcenter()

    }
}
like image 348
Jaz Avatar asked Mar 08 '26 00:03

Jaz


1 Answers

You can always tell Gradle to use the latest version of a dependency; it'll automatically override whatever your transitive dependencies request. E.g., if this is in your build.gradle:

compile 'com.google.android.gms:play-services-cast:8.3.0'
compile 'com.connectsdk:connect-sdk-android:1.6.0'

Even though connect-sdk-android v1.6.0 uses play-services-cast v7.8.0, you'll still get 8.3.0 in your final build.

That said, if Connect SDK's library doesn't work with 8.3.0, then you're stuck until they update their library anyways. In that case, you might want to inform them of the problem on their library's issue page.

like image 150
Dan Lew Avatar answered Mar 10 '26 14:03

Dan Lew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!