【发布时间】:2018-10-03 03:46:42
【问题描述】:
我最近将 Android Studio 升级到 3.1,但遇到版本冲突问题。我的 Gradle 版本是 4.4,Andoid 插件 版本是 3.0.0。我尝试将其更改为 3.1.1。它恢复为以前的版本编号。这让我感到困惑,所以需要你的帮助。同步时,我在 Build 中收到以下消息。
版本冲突:
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.
build.gradle/app
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.globemaster.samples"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:design:27.0.0'
implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】:
-
尝试将类路径 'com.android.tools.build:gradle:3.0.0' 版本更改为类路径 'com.android.tools.build:gradle:3.0.1 并同步
-
不是最新的 3.1.1
-
是的。 3.1.1 是最新的.. 但既然你告诉版本正在恢复,只需尝试 3.0.1,然后再试一次 3.1.1
-
在一些答案中,我在依赖项底部看到了插件。这也是一个问题,因为我将它放在顶部
-
我认为这不重要.. 无论如何,我使用的是相同的 3.1 android studio 和 3.2.1 google 服务和 3.0.1 gradle,我最近更新到 3.1.1,同步没有任何问题.. 尝试使用 3.0.1 是否可以正常工作,然后尝试使用 3.1.1 看看是否有效