Android Firebase DynamiteModule: Failed to load mo

2019-01-03 06:07发布

Since upgrading to the newest version of Firebase (9.0.0), I can't get rid of the following two errors when authenticating a user through signInWithEmailAndPassword(). Does anyone have an idea what's going on?

    05-19 18:09:49.245 23550-23589/[PACKAGE] E/DynamiteModule: Failed to load 
    module descriptor class: Didn't find class 
    "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor" 
on path: DexPathList[[zip file 
"/data/app/[PACKAGE]-3/base.apk"],nativeLibraryDirectories=
[/data/app/[PACKAGE]-3/lib/x86, /vendor/lib, /system/lib]]

And

    05-19 18:09:49.252 23550-23550/[PACKAGE] E/FirebaseApp: Firebase API 
initialization failure.java.lang.reflect.InvocationTargetException

      at java.lang.reflect.Method.invoke(Native Method)
      at com.google.firebase.FirebaseApp.zza(Unknown Source)
      at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
      at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
      at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
      at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
      at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
      at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
      at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)

(...)    
Caused by: 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/[PACKAGE]/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_95503dc60ed409569d1585da411de93e6c633bf7-classes.dex)
      at com.google.firebase.iid.zzg.zzeC(Unknown Source)
      at com.google.firebase.iid.zzg.<init>(Unknown Source)
      at com.google.firebase.iid.zzg.<init>(Unknown Source)
      at com.google.firebase.iid.zzd.zzb(Unknown Source)
      at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.google.firebase.FirebaseApp.zza(Unknown Source) 
      at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
      at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
      at com.google.firebase.FirebaseApp.zzbu(Unknown Source)  
      at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
      at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
      at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
      at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 

(...)

13条回答
forever°为你锁心
2楼-- · 2019-01-03 06:43

I logged out and then logged in and it solved this problem for me.

Probably from some kind of synchronization the FB stuff have not implemented.

If this problem consist I will try to intercept it. But reallly, this is a bug in Firebase system. And It is a bug that is caused by more than one use case, which is another issue on its own.

查看更多
爷的心禁止访问
3楼-- · 2019-01-03 06:43

It may also happen when you don't have the SHA1 fingerprints registered in Firebase and in Google API. There in both of them must register two fingerprints: from the debug keystore and from the production keystore (generated when you create the project's apk for the first time when you enter some password keys on Android Studio).

Here shows how to get the SHA1 from there.

or run this command on C:\Users\<user name>\.android directory.

keytool -list -v -keystore debug.keystore
查看更多
何必那么认真
4楼-- · 2019-01-03 06:45

Very sad that Firebase initialization errors are so not straightforward, so developers need to guess what went wrong. In my case I imported only:

compile 'com.google.firebase:firebase-auth:10.2.0'

and forgot to import also core:

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

Maybe it will help someone, good luck!

查看更多
叼着烟拽天下
5楼-- · 2019-01-03 06:46

I had similar issue with signup the user but finally found a working solution.

Uninstall the HAXM and reinstall it solves my issue and it successfully signup's the user to firebase auth :)

查看更多
姐就是有狂的资本
6楼-- · 2019-01-03 06:46

Sharing my experience: I faced the same issue, I googled everywhere but couldn't find the exact answer, even if I was doing everything as documented by Google Android documentation. Suddenly after a day, my app was working fine and at that same moment I got the email from google stating "Google APIs Explorer connected to your Google Account". And it looks to me that google takes time to grant us access, just wait for this email, maybe this issue is not related to bad code.

查看更多
Explosion°爆炸
7楼-- · 2019-01-03 06:47

Disabling Instant Run worked for me. Sounds ridiculous, I know. I tried cleaning the project. I tried uninstalling/reinstalling the app. The thing that finally did the trick was disabling Instant Run. sigh

查看更多
登录 后发表回答