3

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()

    }
}
Jaz
  • 371
  • 1
  • 6
  • 20

1 Answers1

1

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.

Dan Lew
  • 85,990
  • 32
  • 182
  • 176
  • Thanks Daniel, It looks as though connectSDK is not compatible with 8.3.0 due to a change in an interface. Probably will end up switching to Google's castComanionLibrary as responses from connect sdk are quite slow. I'm guessing it's not possible to compile two different versions of the same library separately? – Jaz Dec 10 '15 at 22:04
  • @Jaz what did you end up doing here? I'm having a very similar issue; my app requires Google Play Services 9.4.0 but a library I'm using (Outbound SDK) uses 9.2.0 and I have no way of updating it's dependency but I don't want to be bound to 9.2.0 just because of it. Any updated thoughts would be much appreciated! – Forrest Bice Sep 01 '16 at 03:58
  • Forrest I eventually just removed the Connect SDK and used the CastCompanionlibrary and now the new Cast Library from Google. Unfortunately I could not find a resolution the the gms library version issue and last I checked which was a few months ago Connect SDK had not been updated to the newer GMS library. Not sure if there is a solution out there but I got tired of looking. – Jaz Sep 01 '16 at 21:58