我读了很多关于这个主题的帖子,但没有人帮助我。 我正在使用 Android Studio 并关注此 guide
这是项目gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
这是应用程序 gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.xyv.appname"
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 {
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.0.1'
compile 'com.android.support:design:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
在这里您可以看到我在我的应用中添加了 google-services.json 的位置:
这些是我的 SDK 工具:
有人知道我的错误是什么吗?
提前致谢
最佳答案
你可能需要添加
compile 'com.google.android.gms:play-services:9.6.1'
也在您的应用程序 build.gradle 中。引用:Upgrade to Google Play Services:9.0.0 Error Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0
如果您最近将版本升级到 3.0.0,您应该在 Android SDK 管理器中仔细检查您的机器上是否安装了正确的版本。
关于java - 无法解析 com.google.gms :google-services:3. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41124322/