I use FireBase authentication with a simple function that signs up a new user, it works great on the Unity Editor, but when I build it on my Android, it crashes the second it tries to read this line- FirebaseAuth auth = FirebaseAuth.DefaultInstance
This is the error I get before it crashes-
Java class com/google/firebase/auth/FirebaseAuthWebException not found. Please verify the AAR which contains the com/google/firebase/auth/FirebaseAuthWebException class is included in your app.
My app is simple- there's a SignUp button that calls this function-
public void SignUp()
{
FirebaseAuth auth = FirebaseAuth.DefaultInstance; //The error is after this line
auth.CreateUserWithEmailAndPasswordAsync(email.text, password.text).ContinueWith(task =>
{
if (task.IsCanceled)
{
Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
return;
}
if (task.IsFaulted)
{
Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
return;
}
// Firebase user has been created.
Firebase.Auth.FirebaseUser newUser = task.Result;
Debug.LogFormat("Firebase user created successfully: {0} ({1})",
newUser.DisplayName, newUser.UserId);
// SignInWithVerification();
});
}
Okay, I managed to solve this. For me it never crashed, but just because I got this error I assumed it was setting the Auth DefaultInstance as null (while it actually worked).
For clarification, I am using Firebase Auth, Firebase Database, Google Play Services.
The error went away when I downgraded to Firebase 5.2.1. I am not sure why this error makes your app crash, maybe it is something else? You could try removing the line and see if it still crashes.
When I realised that this error doesn't actually harm anything I upgraded back to 5.4.0 and even though I get this error, everything works beyond that.
I finally fixed it! It was a problem with the dependencies but was impossible to solve, even though I tried Androd-resolve so many times.
-I removed all Firebase files (make sure you remove everything)
-I removed Library folder (under project folder) not sure if it's necessary
-I removed AndroidResolverDependencies (under projectsettings folder)
-I removed unity folder in C:\Users*\AppData\Local and C:\Users***\AppData\Roaming
-Installed the Firebase package again
-Android resolve
That's it. Nobody could help me with it so I removed EVERYTHING! *Save a backup of everything before you try my solution
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With