使用 firebase 时,任务 app.compileDebugKotlin 的 Android 执行失败



收到此错误

Error:Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

一旦我将这行代码添加到应用程序中

firebaseAuth = FirebaseAuth.getInstance()

Dependency已添加到 gradle 应用模块

compile 'com.google.firebase:firebase-auth:10.0.1'

知道是什么导致了这个错误吗?

编辑

: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.google.firebase.auth.FirebaseAuth, unresolved supertypes: com.google.android.gms.internal.zzbql

但我确实有

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.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'io.reactivex:rxkotlin:0.21.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.dagger:dagger:2.4'
testCompile 'junit:junit:4.12'
kapt 'com.google.dagger:dagger-compiler:2.4'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
**Project gradle**
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-5'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

**app gradle**
dependencies {      
implementation 'com.google.firebase:firebase-auth:11.0.2'
implementation 'com.google.firebase:firebase-database:11.0.2'
implementation 'com.google.firebase:firebase-ads:11.0.2'
implementation 'com.google.android.gms:play-services-location:11.0.2'
}
**Please add this below dependencies and make sure firebase and play-services versions should be same.**
apply plugin: 'com.google.gms.google-services'

最新更新