web-dev-qa-db-fra.com

Configuration de Firebase: ClassNotFoundException

Je vois l'erreur suivante après avoir ajouté RemoteConfig.

2020-04-02 16:47:06.844 12100-12100/removed W/ComponentDiscovery: Class com.google.firebase.remoteconfig.ktx.FirebaseConfigKtxRegistrar is not an found.
Java.lang.ClassNotFoundException: com.google.firebase.remoteconfig.ktx.FirebaseConfigKtxRegistrar
    at Java.lang.Class.classForName(Native Method)
    at Java.lang.Class.forName(Class.Java:453)
    at Java.lang.Class.forName(Class.Java:378)
    at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-components@@16.0.0:80)
    at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-components@@16.0.0:73)
    at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@19.3.0:404)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:300)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:268)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:253)
    at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
    at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1927)
    at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1902)
    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45)
    at Android.app.ActivityThread.installProvider(ActivityThread.Java:6528)
    at Android.app.ActivityThread.installContentProviders(ActivityThread.Java:6021)
    at Android.app.ActivityThread.handleBindApplication(ActivityThread.Java:5927)
    at Android.app.ActivityThread.access$1200(ActivityThread.Java:200)
    at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1673)
    at Android.os.Handler.dispatchMessage(Handler.Java:106)
    at Android.os.Looper.loop(Looper.Java:201)
    at Android.app.ActivityThread.main(ActivityThread.Java:6806)
    at Java.lang.reflect.Method.invoke(Native Method)
    at com.Android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.Java:547)
    at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:873)
 Caused by: Java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.remoteconfig.ktx.FirebaseConfigKtxRegistrar" on path: DexPathList[[Zip file "/data/app/removed-VBiXJeGazGh2qyHGB8IDBA==/base.apk"],nativeLibraryDirectories=[/data/app/removed-VBiXJeGazGh2qyHGB8IDBA==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.Java:134)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:379)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:312)
    at Java.lang.Class.classForName(Native Method) 
    at Java.lang.Class.forName(Class.Java:453) 
    at Java.lang.Class.forName(Class.Java:378) 
    at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-components@@16.0.0:80) 
    at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-components@@16.0.0:73) 
    at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@19.3.0:404) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:300) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:268) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:253) 
    at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51) 
    at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1927) 
    at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1902) 
    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45) 
    at Android.app.ActivityThread.installProvider(ActivityThread.Java:6528) 
    at Android.app.ActivityThread.installContentProviders(ActivityThread.Java:6021) 
    at Android.app.ActivityThread.handleBindApplication(ActivityThread.Java:5927) 
    at Android.app.ActivityThread.access$1200(ActivityThread.Java:200) 
    at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1673) 
    at Android.os.Handler.dispatchMessage(Handler.Java:106) 
    at Android.os.Looper.loop(Looper.Java:201) 
    at Android.app.ActivityThread.main(ActivityThread.Java:6806) 
    at Java.lang.reflect.Method.invoke(Native Method) 
    at com.Android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.Java:547) 
    at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:873) 

Dépendances Gradle

def room_version = "2.2.4"
api 'com.google.Android.material:material:1.2.0-alpha05'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0-alpha03'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.Android.material:material:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.2.1'
implementation 'androidx.navigation:navigation-ui:2.2.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'com.google.firebase:firebase-messaging:20.1.3'
implementation 'com.google.firebase:firebase-core:17.2.3'
implementation 'com.google.firebase:firebase-firestore-ktx:21.4.1'
implementation 'com.google.firebase:firebase-auth:19.3.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.json:json:20140107'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.Android.volley:volley:1.1.1'
implementation 'com.squareup.okhttp3:okhttp:4.3.1'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation 'com.auth0.Android:jwtdecode:1.4.0'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'com.google.Android:flexbox:2.0.1'
implementation 'joda-time:joda-time:2.10.5'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.Android.support:multidex:1.0.3'
implementation 'info.androidhive:fontawesome:0.0.5'
implementation 'com.google.Android.gms:play-services-auth:17.0.0'
implementation 'com.google.Android.gms:play-services-auth-api-phone:17.4.0'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.razorpay:checkout:1.5.13'
implementation "com.airbnb.Android:lottie:$lottieVersion"
implementation 'com.github.AppIntro:AppIntro:5.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4"
// Recommended: Add the FireBase SDK for Google Analytics.
implementation 'com.google.firebase:firebase-analytics:17.2.3'
// Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta02'
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// For Kotlin use kapt instead of annotationProcessor
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
implementation 'com.github.GrenderG:Toasty:1.4.2'
implementation 'me.zhanghai.Android.materialprogressbar:library:1.6.1'
implementation 'com.google.firebase:firebase-storage-ktx:19.1.1'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'id.zelory:compressor:3.0.0'
implementation 'com.google.firebase:firebase-appindexing:19.1.0'
implementation 'com.google.firebase:firebase-config-ktx:19.1.3'

Synchroniser la configuration à distance

 private fun initRemoteConfig(){
    val configSettings = remoteConfigSettings {
        minimumFetchIntervalInSeconds = 3600//3
    }
    remoteConfig.setConfigSettingsAsync(configSettings)
    remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)
    remoteConfig.fetchAndActivate()
}

J'ai une copie locale de la configuration de firebase. Tout fonctionne bien. Je vois juste l'erreur dans la console.

9
The_ehT

J'ai le même problème. Heureusement, il y a déjà un correctif dans le pipeline: https://github.com/firebase/firebase-Android-sdk/pull/1209 ... malheureusement, il est toujours ouvert. Depuis le 6 février: - /

Edit: réalisé que cette erreur n'est pas un problème. La configuration à distance fonctionne toujours

2
Jens Schmitt