有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java错误:无法访问InternalTokenProvider(Firebase/GooglePlayServices)

在我使用firebase、firebase ui、谷歌地图等的应用程序中,它工作得非常好我想更新到每个库的最新版本并安装Firebase Performance

我得到的错误是:

error: cannot access InternalTokenProvider
class file for com.google.firebase.internal.InternalTokenProvider not found

当我单击此错误时,它会将我发送到以下行的活动:

auth = FirebaseAuth.getInstance();

这是我的身材。格拉德尔:

apply plugin: 'com.安卓.application'
apply plugin: 'kotlin-安卓-extensions'
apply plugin: 'kotlin-安卓'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

安卓 {
    signingConfigs {
        release {
            //signin things
        }
    }
    compileSdkVersion 28
    defaultConfig {

        applicationId "app.example.asd"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 22
        versionName "2"
        testInstrumentationRunner "安卓x.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        signingConfig signingConfigs.release
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation '安卓x.appcompat:appcompat:1.0.0'
    implementation '安卓x.gridlayout:gridlayout:1.0.0'
    implementation 'com.google.安卓.material:material:1.0.0'

    implementation 'com.google.firebase:firebase-perf:17.0.0'

    implementation '安卓x.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.facebook.安卓:facebook-安卓-sdk:4.42.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation "com.google.firebase:firebase-auth:16.0.1"
    implementation 'com.firebaseui:firebase-ui:4.3.2'
    implementation 'com.facebook.安卓:facebook-login:4.42.0'
    implementation '安卓x.multidex:multidex:2.0.1'
    implementation 'com.google.安卓.gms:play-services-base:16.1.0'
    implementation 'com.google.安卓.gms:play-services-location:16.0.0'
    implementation 'com.google.安卓.gms:play-services-maps:16.1.0'
    implementation 'com.google.安卓.gms:play-services-auth:16.0.1'
    implementation 'com.google.安卓.gms:play-services-places:16.1.0'

    implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'

    implementation 'com.facebook.安卓:facebook-share:4.42.0'

    implementation 'com.安卓.volley:volley:1.1.1'

    implementation 'com.crashlytics.sdk.安卓:crashlytics:2.10.0'

    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

    testImplementation 'junit:junit:4.12'
    安卓TestImplementation '安卓x.test:runner:1.1.1'
    安卓TestImplementation '安卓x.test.espresso:espresso-core:3.1.1'

    //kt y rxjava
    implementation '安卓x.core:core-ktx:1.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'
    implementation 'io.reactivex.rxjava2:rx安卓:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
    //lib en kt
}

repositories {
    mavenCentral()
}
apply plugin: 'com.google.gms.google-services'

有人能检测到我的依赖项中存在的问题吗谢谢

更新 在Peter的帮助下,我得以更正错误,从firebase auth:16.0.1更改为firebase auth:17.0.0

现在,我在安装和打开我的应用程序时遇到另一个错误,就是这样:

java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (3.0.0). Please report to firebase-database-client@google.com
        at com.google.firebase.database.安卓.AndroidPlatform$1$1.run(com.google.firebase:firebase-database@@16.0.5:98)
        at 安卓.os.Handler.handleCallback(Handler.java:790)
        at 安卓.os.Handler.dispatchMessage(Handler.java:99)
        at 安卓.os.Looper.loop(Looper.java:164)
        at 安卓.app.ActivityThread.main(ActivityThread.java:7000)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.安卓.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
        at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListener;

第一次在我的应用程序中使用此行时出现错误:

myRef = FirebaseDatabase.getInstance().getReference();

共 (5) 个答案

  1. # 1 楼答案

    执行官网。谷歌。firebase:firebase授权:16.0.5'

    执行官网。谷歌。firebase:firebase数据库:17.0.0'

  2. # 2 楼答案

    implementation 'com.google.firebase:firebase-database:16.0.5'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    

    或者:

    implementation 'com.google.firebase:firebase-analytics:17.4.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    

    同步到此版本并查看
    如果没有,请升级Android Studio上的Firebase工具

  3. # 3 楼答案

    看起来您是通过对com.firebaseui:firebase-ui:4.3.2https://github.com/firebase/FirebaseUI-Android/releases/tag/4.3.2)的依赖关系来com.google.firebase:firebase-database:16.0.5

    尝试将此添加到build.gradle

    implementation 'com.google.firebase:firebase-database:17.0.0'
    

    此外,一般检查您使用的是最新版本,可以在https://firebase.google.com/docs/android/setup#available-libraries

    注意:这是基于从firebase auth:16.0.1更改为firebase auth:17.0.0后更新中出现的新错误

  4. # 4 楼答案

    改变这一点:

    implementation 'com.google.firebase:firebase-auth:16.0.1'
    

    对此:

    implementation 'com.google.firebase:firebase-auth:17.0.0' 
    
  5. # 5 楼答案

    只需将鼠标悬停在Firebase Auth、Cloud等所有组件上,即可将其升级至最新版本