Kevin Van Ryckegem Kevin Van Ryckegem - 2 months ago 25
Android Question

Firebase Analytics keeps causing errors in Android, why?

After I installed Firebase Analytics in my Android app, I keep getting the following error and crash of the app.

10-03 19:08:03.917 17740-17759/******* E/FA: Task exception on worker thread: java.lang.IncompatibleClassChangeError:
The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct
(declaration of 'com.google.firebase.iid.zzg' appears in /data/data/********/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_4ac10bd34145eacbd51560cb14cd41a784d8c1aa-classes.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)


Any idea why and what causes this error?

Answer

I think something was wrong in the documentation. The instructions didn't tell me this extra step.

I was missing a dependency:

compile 'com.google.firebase:firebase-core:9.6.1'

In the support docs, however it is clearly mentioned. I added it and it works fine now.