使用gms play服务的Android依赖问题 [英] Android dependency issue with gms play services

查看:2338
本文介绍了使用gms play服务的Android依赖问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我尝试使用Google的应用索引库,同时还导入了一个使用旧版本的android gms库的库,以用于其他组件 - Google的强制转型库,因此我收到错误播放服务。错误状态为所有com.google.android.gms库必须使用完全相同的版本规范(混合版本可能导致runtine崩溃)。发现版本8.30,7.80。示例包括com.google.android.gms:play-servics- appindexing:8.3.0和com.google.android.gms:play-services-cast:7.8.0。
不知道如何解决这个问题,因为我无法更新用于connectionsdk的版本,我的gradle文件如下:

模块

  android {

compileSdkVersion 23
buildToolsVersion23.0.2
useLibrary'org.apache.http.legacy'

defaultConfig {
applicationId xxx.xxx.xxx.xxx
minSdkVersion 15
targetSdkVersion 23
versionCode 10005
versionName1.0.5
multiDexEnabled true
}

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


依赖关系{

编译fileTree(dir:'libs',include:['* .jar'])
编译文件('libs / commons-lang3-3.3.2.jar')
编译文件('libs / universal-image-loader-1.9.3.jar')
compile'c​​om.android.support:multidex:1.0.1'
compile'c​​om.facebook.android:facebook-android-sdk:4.6 .0'
compile'c​​om.android.support:appcompat-v7:23.1.1'
compile'c​​om.google.android.gms:play-services-appindexing:8.3.0'
编译'com.google.android.gms:play-services-analytics:8.3.0'
compile('com.connectsdk:connect-sdk-android:1.6。+')

**项目**:

buildscript {
存储库{
jcenter()
}
依赖关系{
classpath'com.android .tools.build:gradle:1.3.0'
classpath'com.google.gms:google-services:1.5.0-beta2'
//注意:不要放置您的appl依赖关系在这里;它们属于单个模块build.gradle文件中的
//
}
}

allprojects {
存储库{
jcenter()




解决方案

你总是可以告诉Gradle使用最新版本的依赖关系;它会自动覆盖你的传递依赖关系请求。例如,如果它在 build.gradle 中:

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

即使connect-sdk-android v1.6.0使用play-services-cast v7.8.0,在最终版本中仍然会获得8.3.0。这就是说,如果Connect SDK的库不能在8.3.0下工作,那么你一直坚持到他们更新库为止。在这种情况下,您可能需要在其图书馆的问题页面上向他们通报问题。

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

    }
}

解决方案

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.

这篇关于使用gms play服务的Android依赖问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆