根据 FB 文档做了所有事情 here但 编译时仍然出现以下错误:
Error:(44, 13) Failed to resolve: com.google.firebase:firebase-core:9.6.0
我的 SDK 经理说一切都是最新的:
Google Play services Rev. 33 installed
Google Repository Rev. 35 installed
这是我的 build.gradle 内容:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "xxxx.xxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 14
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// Support libraries
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
// Google APIs
// Note: Avoid compiling the entire play-services package.
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-places:9.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4.4'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.google.code.gson:gson:2.7'
compile 'io.branch.sdk.android:library:2.+'
compile 'com.google.firebase:firebase-core:9.6.0' //<-- CAUSING TROUBLE
}
apply plugin: 'com.google.gms.google-services'
这是我的根级build.gradle内容:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.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()
}
}
为什么不编译?
最佳答案
@Lorenzo Quiroli 提供的答案可能会对您有所帮助,您需要相同版本的 Firebase 和 Google Play 服务。
在我的例子中,我将所有设置都设置为 9.6.0,但仍然出现错误。我通过 SDK 管理器更新到最新的 google-play-services 和 google 存储库解决了这个问题:
现在我知道这对您没有帮助,因为您已经更新了这些,但它可能对其他人有帮助。
关于android - 无法解析 : com. google.firebase :firebase-core:9. 6.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39674484/