android与gms的区别,所有com.google.android.gms库必须使用完全相同的版本规范吗?

在构建Android应用时,遇到关于com.google.android.gms库版本不一致的警告,提示可能导致运行时崩溃。警告指出发现不同版本如9.2.0和8.4.0,建议所有GMS库使用相同版本。文章内容涉及build.gradle配置,包括依赖管理和版本控制问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我在行compile 'com.google.android.gms:play-services-analytics:9.2.0'的构建等级中收到以下警告消息。这是什么意思?

All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 9.2.0, 8.4.0. Examples include com.google.android.gms:play-services-basement:9.2.0 and com.google.android.gms:play-services-ads:8.4.0 less... (Ctrl+F1)

There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

这是我的应用build.gradle:

plugins {

id "me.tatarka.retrolambda" version "3.2.5"

}

apply plugin: 'com.android.application'

android {

compileSdkVersion 24

buildToolsVersion '23.0.3'

defaultConfig {

applicationId "com.elgami.customizer"

minSdkVersion 15

targetSdkVersion 24

multiDexEnabled true // Enabling multidex support.

renderscriptTargetApi 23

renderscriptSupportModeEnabled true

}

buildTypes {

release {

minifyEnabled false

//runProguard false

//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

}

}

compileOptions {

sourceCompatibility JavaVersion.VERSION_1_8

targetCompatibility JavaVersion.VERSION_1_8

}

}

repositories {

mavenCentral()

maven { url "https://jitpack.io" }

}

dependencies {

compile 'com.facebook.android:audience-network-sdk:4.13.0'

compile 'com.bartoszlipinski:recyclerviewheader2:2.0.1'

compile 'com.ms-square:etsyblur:0.1.3'

compile 'com.android.support:appcompat-v7:24.0.0'

// recyclerview

compile 'com.android.support:recyclerview-v7:24.0.0'

// google analytics`

compile 'com.google.android.gms:play-services-analytics:9.2.0'

compile 'com.google.android.gms:play-services-appindexing:9.2.0'

// amazon S3 uploads todo remove (5k methods)

compile 'com.amazonaws:aws-android-sdk-s3:2.2.18'

// paypal purchasing todo change to 'compile' (2k more methods..?)

compile files('libs/PayPalAndroidSDK-2.7.1.jar')

// Module dependency on ParseLoginUI library sources

compile project(':ParseLoginUI')

// Consider using these in future - Wes Feb 2016

//compile 'com.parse:parseui-login-android:0.0.1'

//compile 'com.parse:parseui-widget-android:0.0.1'

// Parse

compile 'com.parse:parse-android:1.13.0'

compile 'com.parse:parsetwitterutils-android:1.10.5'

compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'

// excluding bolts-android because parse-android uses bolts-tasks which conflicts

// hint: use 'gradlew app:dependencies' to inspect

compile('com.facebook.android:facebook-android-sdk:4.9.0') {

exclude module: 'bolts-android'

exclude module: 'bolts-tasks'

}

// butterknife

compile 'com.jakewharton:butterknife:6.1.0'

// app rater

compile files('libs/AppRater.jar')

// retrofit http api

compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'

compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'

compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'

compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'

// reactivex

compile 'io.reactivex:rxjava:1.1.1'

compile 'io.reactivex:rxandroid:1.1.0'

// picasso image loading

compile 'com.squareup.picasso:picasso:2.5.2'

// stripe for payment processing

compile 'com.stripe:stripe-android:1.0.4'

}

项目级gradle:

// 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:2.1.2'

}

}

allprojects {

repositories {

jcenter()

}

}

关于Google Play services的各个分支介绍(MX5一定要安装XXXXXX-448分支) 要想使用google play, google map等google应用,就必须安装Google Play Service,但Google Play Service有太多分支了,最近终于搞明白各个分支代表什么。 版本号最后三位(2104405-XYZ)分别表示Android版本,cpu的arm系列,屏幕密度(DPI)。 下面是具体分支介绍: Notes / What's New Uploader's notes: To figure out the right version of Google Play services for your Android device, go to Settings -> Apps -> Google Play services, and look at the last 3 numbers in the parentheses. You'll see something like -XYZ where: 1.第一位X * X defines Android version: 0 for Android =5.0 // 4和7表示Android5.0及以上 8 for Android TV // 8表示Android电视应用 2.第二位Y * Y defines CPU architecture: 1 for armeabi 3 for armeabi-v7a // 32位版本 4 for arm64-v8a // 64位v8版本,MX5必须是这个 7 for x86 // x86主要是对intel cpu来说的 3.第三位Z * Z defines DPI: 0 for universal 2 for 160 4 for 240 6 for 320 8 for 480 // MX5选这个就行了 Notes: It seems that -7YZ builds became -4YZ with Google Play services 6.5. If you were on -7YZ before, you should now install -4YZ. Looks like -8YZ builds are for Android TV. Examples: -014 for Android <5.0 armeabi CPU 240 DPI device -438 for Android 5.0+ armeabi-v7a CPU 480 DPI device -876 for Android TV x86 CPU 320 DPI device 国内用户可以直接从以下镜像网站下载最新到Google Play Service http://www.apkmirror.com/apk/google-inc/google-play-services/ 目前最新版本Google Play services 7.8.93 MX5用户可以安装以下分支: Google Play services 7.8.93 (2104405-448) http://www.apkmirror.com/apk/google-inc/google-play-services/google-play-services-7-8-93-2104405-448-android-apk-download/ 另外,安装后好需要禁止系统自带【应用中心】自动安装更新,可以设置面流量更新,但不要设置“静默安装更新包”,否则新版本发布后会自动更新成应用中心的最新版本,而最新版本的后三位可能不是你想要的分支,这时候就会导致弹出提示架构不符等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值