找不到参数[com.goms:google services:4.0.0]的方法compile()



我的项目正在运行。但当我试图打开这个项目时,安卓工作室给出了错误:

在org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.类型的对象上找不到参数[com.google.gms:google services:4.2.0]的方法compile((

项目等级文件如下所示:

buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
jcenter()
}
dependencies {

classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
compile 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven{url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

应用程序渐变文件如下所示:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.asnus.moviefinder"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'com.android.support:appcompat-v7:28.0.0-rc01'
compile 'com.android.support.constraint:constraint-layout:1.1.2'
compile 'com.android.support:support-v4:28.0.0-rc01'
compile 'com.android.support:design:28.0.0-rc01'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
//cardview
compile "com.android.support:cardview-v7:28.0.0-rc01"
//recylerview
compile 'com.android.support:recyclerview-v7:28.0.0-rc01'
//picasso
compile 'com.squareup.picasso:picasso:2.71828'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
//Firebase
compile 'com.google.firebase:firebase-auth:16.0.3'
compile 'com.google.android.gms:play-services-auth:16.0.0'
compile 'com.google.firebase:firebase-firestore:17.1.0'
//Seekbar
compile 'com.crystal:crystalrangeseekbar:1.0.0'
//Search Dialog
compile 'com.github.mirrajabi:search-dialog:1.1'
//Fab Button
compile 'com.github.dimorinny:floating-text-button:0.0.4'
//Circle ImageView
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'

在项目的build.gradle中添加maven { url 'https://dl.bintray.com/android/android-tools' },如下所示:

buildscript {
repositories {
maven { url 'https://dl.bintray.com/android/android-tools' }
...
}
}

有关更多信息,请参阅此答案

compile 'com.google.gms:google-services:4.2.0'依赖项从项目的build.gradle移动到应用程序的build.gradle文件。

来自

repositories {
google()
mavenCentral()
}

repositories {
google()
maven {
url "https://maven.google.com"
}
}

相关内容

最新更新