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条回答
Ridiculous、
2楼-- · 2019-01-03 06:48

You can check out while adding google sign in option Before we use

GoogleSignInOptions gso = new GoogleSignInOptions
                    .Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                    .requestEmail()
                    .build();

add one line as show in the following code

GoogleSignInOptions gso = new GoogleSignInOptions
                .Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

after adding this if you get the error like

An internal error has occured. [ Invalid Idp Response: id_token audience mismatch. ]

then Click here to get solution this works for me.

查看更多
混吃等死
3楼-- · 2019-01-03 06:49

if you do everything but you got nothing try to update your ARM EABI.

Google APIs ARM EABI v7a System Image

If your emulator has not new goggle updates you will get always auth error.

Do everything suggested in this post then update ARM EABI image. This solved my problem.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-03 06:52

This answer on another question made my app authenticate

Alfonso Gomez Jordana Manas

Hello Pierre,

You have to manually whitelist your existing Google OAuth 2.0 client IDs in the Firebase console before using it with the new Auth APIs.

In order to do so, follow these steps:

  • Go to the Credentials section in the Google API Console.
  • Select from the top right corner the project where you had previously configured Google Sign-In.
  • Go to the OAuth 2.0 client IDs section If you are using Google Sign-In on Android or iOS applications: Take note of the Client ID string corresponding to all the entries registered for your applications.
  • Input these Client IDs into your Firebase project’s configuration:
  • Go to the Firebase console at https://console.firebase.google.com
  • Open the Auth section

    Under Sign-In methods, open the Google configuration, and add all your client IDs to the whitelist of client IDs from external projects. If you are using Google Sign-In on a web application: Click to open your web client ID and take note of both the client ID and secret. Input this Client ID into your Firebase project’s configuration: Go to the Firebase console at https://console.firebase.google.com Open the Auth section Under Sign-In methods, open the Google configuration, and add the values under the Web SDK configuration section.

Let me know if this resolves your issue.

查看更多
再贱就再见
5楼-- · 2019-01-03 07:00

If you just want to use the Firebase authentication and you got here because of the error:

Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"

Go to https://console.firebase.google.com/project/[your project]/authentication/providers and enable the authentication providers you support.

查看更多
forever°为你锁心
6楼-- · 2019-01-03 07:03

I had the same problem and I found a mistake done by me in my Firebase console.

One of the reason for this problem could be, your Sign In Method inside Firebase > Auth Dashboard might be disabled.

I just enabled it and it started working.

查看更多
乱世女痞
7楼-- · 2019-01-03 07:08

Can you check your Google Play Services version?

From Firebase oficial website:

Prerequisites

  • An Android device running Google Play services 9.0.0 or later
  • The Google Play services SDK from the Android SDK Manager
  • Android Studio 1.5 or higher
  • An Android Studio project and its package name.
查看更多
登录 后发表回答