在尝试更新到最新的 Glide 时,我获得了更新新的 google 服务的信息,我已将其引入 gradle,从这一刻起 nothink 不再有效。 我尝试过的:
1)我读到,当某些依赖项的版本与其他依赖项的版本不同时,可能会发生此错误,因此我尝试//(暂时删除)所有依赖项,而不是一一“UnHash”依赖项来解决问题一个但没有解决问题
2) 我尝试编译 com.google.gms:google-services:3.1.1/3.1.2/3.0.0/3.1.0 但这些都不起作用
3) 我尝试了 https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f 中的方法并强制编译,但没有成功
我得到的错误
Error:(10, 0) Could not find method compile() for arguments [com.google.gms:google-services:3.1.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Open File
我将非常感谢您的帮助!
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
google()
}
dependencies {
compile 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
compile 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
第二个build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.lenovo.licz4"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support:support-v4:26.1.0'
implementation "android.arch.lifecycle:extensions:1.0.0-rc1"
implementation "android.arch.lifecycle:runtime:1.0.3"
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-rc1"
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:preference-v14:26.1.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:preference-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.github.bumptech.glide:glide:4.3.0'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'
最佳答案
删除顶级文件中的这些行:
compile 'com.google.gms:google-services:3.1.1'
compile 'com.google.gms:google-services:3.1.0'
和添加:
classpath 'com.google.gms:google-services:3.1.0'
关于android - 找不到参数的方法compile() [com.google.gms :google-services:3. 1.1],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47114976/