找不到com.google.gms:google-services:3.1.1 [英] Could not find com.google.gms:google-services:3.1.1
问题描述
我得到了例外:
Could not find com.google.gms:google-services:3.1.1.
当我启动我的android项目时.
when I start my android project.
我的build.gradle(项目:android)
My build.gradle (Project: android)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和build.gradle(模块:应用程序)
and the build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "de.derdoenerdon.ressourcencockpit"
minSdkVersion 15
targetSdkVersion 25
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:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.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:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.4.0'
compile 'com.github.OPCFoundation:UA-Java:1.03.342.0'
testCompile 'junit:junit:4.12'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.7'
}
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.1.1'
}
}
apply plugin: 'com.google.gms.google-services'
关于任何帮助,我将非常感谢.我是android新手. 发生这种情况是因为我尝试在应用程序中使用firebase并自动在应用程序中添加了一些依赖关系. 非常感谢
About any help, I would be very thankful. I am new in android. It happens, since I try to use firebase in my application and it added some dependency in my application automatically. Thanks a lot
这就是我的gradle.build(模块:应用)现在的样子:
This is how my gradle.build (Module: app) looks now:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "de.derdoenerdon.ressourcencockpit"
minSdkVersion 15
targetSdkVersion 25
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:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:25.4.0'
implementation 'com.github.OPCFoundation:UA-Java:1.03.342.0'
testImplementation 'junit:junit:4.12'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.7'
}
apply plugin: 'com.google.gms.google-services'
这是警告,我将其作为输出得到:
and this is the warning, which I get as output:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
有人知道,如何删除此警告?谢谢
Does anybody know, how to remove this warning? Thanks
推荐答案
添加类路径
'com.google.gms:google-services:3.1.1'
在项目gradle中的依赖关系不在module.app gradle中,如下所示:
in the project gradle in the dependencies not in the module.app gradle as follows:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath '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
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这篇关于找不到com.google.gms:google-services:3.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!