我在gradle文件中使用此依赖项:
compile 'com.google.android.gms:play-services:10.2.4'
但是我收到了这个错误:
所有com.google.android.gms库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。发现 版本8.3.0,10.2.4。例子包括
com.google.android.gms:play-services-measurement:8.3.0
和com.google.android.gms:play-services-ads-lite:10.2.4
但我不是在使用游戏服务测量。我甚至都不知道它是什么。有什么想法吗?
这是我完整的gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1' //https://developer.android.com/studio/releases/gradle-plugin.html
classpath 'com.google.gms:google-services:3.0.0'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileOptions {
encoding "UTF-8"
}
lintOptions {
disable 'MissingTranslation'
}
defaultConfig {
applicationId "xx.yy.zz"
minSdkVersion 9
targetSdkVersion 23
versionCode 120
versionName "1.20"
multiDexEnabled true //Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.each { output ->
def formattedDate = new Date().format('yyyyMMddHHmmss')
def newName = output.outputFile.name
newName = newName.replace("app-", "MyAppName")
newName = newName.replace("-release", "-release" + formattedDate)
//noinspection GroovyAssignabilityCheck
output.outputFile = new File(output.outputFile.parent, newName)
}
}
}
repositories {
maven { url 'http://ksoap2-android.googleco/svde.cmomn/2-repo' }
}
}
}
//Lates play-services: https://developers.google.com/android/guides/setup
//and https://developers.google.com/android/guides/setup
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.android.gms:play-services:10.2.4'
//compile 'com.google.android.gms:play-services-maps:10.2.4'
//compile 'com.google.android.gms:play-services-ads:10.2.4'
//compile 'com.google.android.gms:play-services-measurement:10.2.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile project(':simple-crop-image-lib')
compile 'com.android.support:cardview-v7:25.3.1'
//compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
}