【发布时间】:2018-08-08 08:23:50
【问题描述】:
我正在将 firebase 添加到我的项目中,如官方网站中所述。
在第四步中,它说添加compile 'com.google.firebase:firebase-core:16.0.0'。
但尝试同步 gradle 时会出错:
并尝试下载它们 (install repository abd synch project) 我会收到此错误:
这是我的 gradle 依赖项:
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
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.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.google.firebase:firebase-auth:11.6.2'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.code.gson:gson:2.7'
compile('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.onesignal:OneSignal:3.6.5'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
}
这个答案也不起作用: this
更新
我的项目级 gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.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()
maven { url 'https://maven.google.com' }
mavenCentral()
google()
}
}
【问题讨论】:
-
不是答案,而是使用
implementation而不是compile。 -
您是否在 build.gradle 文件末尾添加了
apply plugin: 'com.google.gms.google-services'?我在你的代码中看不到它。
标签: android firebase android-studio android-studio-3.0