首页 > 解决方案 > 添加库时的 FirebaseInitProvider 错误

问题描述

我正在尝试在我的设备上运行该应用程序,一切顺利,直到添加 emojilike 库(在下面的代码中注释掉)。应用程序在模拟器上运行,问题只出现在我的手机上。

我也尝试从 github 添加一些其他库,它也有效。我知道在 stackoverflow 上有类似的问题,但我尝试了所有这些问题。

我收到此错误:

java.lang.RuntimeException:无法获取提供程序 com.google.firebase.provider.FirebaseInitProvider:java.lang.ClassNotFoundException:在路径上找不到类“com.google.firebase.provider.FirebaseInitProvider”:DexPathList [[zip 文件"/data/app/com.koddev-SBJ0Pe4ZQGhO6xUQ4jTjYg==/base.apk"],nativeLibraryDirectories=[/data/app/com.koddev-SBJ0Pe4ZQGhO6xUQ4jTjYg==/lib/arm64, /system/lib64, /system/vendor/库64]]

这是我的 build.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.koddev"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-database:19.2.0'
    implementation 'com.google.firebase:firebase-storage:19.1.0'
    implementation 'com.google.firebase:firebase-firestore:21.3.1'

    implementation 'androidx.multidex:multidex:2.0.1'


    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'

    implementation 'com.github.pwittchen:swipe-rx2:0.3.0'

    implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'

//    implementation 'com.github.andob:emojilike-android:beta3'
    implementation 'com.vanniktech:emoji-ios:0.6.0'
}

apply plugin: 'com.google.gms.google-services'

标签: androidfirebaseandroid-studio

解决方案


推荐阅读