Не удалось получить поставщика com.google.firebase.provider.FirebaseInitProvider в 2020 году - PullRequest
0 голосов
/ 18 февраля 2020

Я сделал этот же вопрос несколько дней go, и некоторые сказали, что ответ может быть в этом другом вопросе Не нашел класс "com.google.firebase.provider.FirebaseInitProvider"? , или в этом Невозможно получить поставщика com.google.firebase.provider.FirebaseInitProvider . Но правда в том, что никто из них не помог мне. Прежде всего, это 3-летние вопросы, и большинство принятых ответов тоже, так как с момента запуска AndroidX многое изменилось. Во-вторых, в этих других вопросах большинство решений состоит в том, чтобы применять мультидекс (https://developer.android.com/studio/build/multidex), но они используют minSdkVersion ниже 20, поэтому им нужно применять мультидекс, так как это требуется, если вы используете API 20 или ниже, согласно официальной документации, на которую я ссылался выше. НО в моем проекте используется minSdkVersion 23, и опять же, в соответствии с документацией «Если для minSdkVersion установлено значение 21 или выше, мультидекс по умолчанию включен, и вам не нужна библиотека поддержки мультидекса». Так что я действительно не знаю, что мне делать, какие-либо идеи?

Это Logcat и файл app.gradle

2020-02-17 01:33:43.871 5975-5975/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.Interactive.textmefriends, PID: 5975
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.Interactive.textmefriends-e44Txln6Z1Rx80v1hUODRQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.Interactive.textmefriends-e44Txln6Z1Rx80v1hUODRQ==/lib/x86, /system/lib, /vendor/lib]]
    at android.app.ActivityThread.installProvider(ActivityThread.java:6288)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
    at android.app.ActivityThread.-wrap1(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.Interactive.textmefriends-e44Txln6Z1Rx80v1hUODRQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.Interactive.textmefriends-e44Txln6Z1Rx80v1hUODRQ==/lib/x86, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6273)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851) 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772) 
    at android.app.ActivityThread.-wrap1(Unknown Source:0) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661) 
    at android.os.Handler.dispatchMessage(Handler.java:105) 
    at android.os.Looper.loop(Looper.java:164) 
    at android.app.ActivityThread.main(ActivityThread.java:6541) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

build.gradle module: app

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

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'

    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-database:19.2.1'
    //implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'

    implementation 'com.squareup.retrofit2:retrofit:2.7.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'

    implementation 'com.google.firebase:firebase-storage:19.1.1'
    implementation "androidx.fragment:fragment:1.2.1"
    implementation 'com.google.firebase:firebase-ads:18.3.0'

    implementation 'androidx.multidex:multidex:2.0.1'

    implementation 'com.google.firebase:firebase-firestore:21.4.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...