这个问题在这里已有答案:
嗨,我开始在Android和导入firebase的新项目,如谷歌文档中所述 . 在Android studio 3.0.1中,一切都很完美 . 现在我将我的Android工作室更新为3.2.1 . 现在相同的代码重建并得到错误
找不到com.google.gms:google-services:4.0.1
记录是:
Could not find com.google.gms:google-services:4.0.1.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
Required by:
project :
我的项目级别Gradle是:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级Gradle是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.arafa.sms"
minSdkVersion 21
targetSdkVersion 27
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:animated-vector-drawable:27.1.0'
implementation 'com.android.support:support-media-compat:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.okhttp3:okhttp:3.3.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
这是什么问题!请帮帮我!
3 回答
我有同样的问题,似乎Google repo缺少这种依赖 . 我检查了repository和gms文件夹不包含任何已发布的版本 .
因此,作为快速修复,我添加了另一个存储库,它有:
EDIT: 因为这只是 temporary solution and I consider it as a workaround 所以我能够继续发展 . 稍后当Google存储库包含依赖项或我们知道它们移动它的位置时,我将删除此依赖性 .
尝试将另一个maven存储库添加到项目gradle文件中 . 例如:
如果那不是't work, adding the OneSignal gradle plugin, also to the project' s gradle,可能会做的伎俩(as suggested in this answer) .
请用vpn测试
也没有修复你可以使用oneSignal,use it
和android studio java的简单代码,Kotlin