[Unity-Android] Crash when using firebase Auth

2,259 views
Skip to first unread message

lo...@nct.vn

unread,
Feb 27, 2017, 10:36:50 AM2/27/17
to Firebase Google Group
I'm using firebase Auth to ask user login via Google+
Here is my code :

Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

                Firebase.Auth.Credential cre = Firebase.Auth.GoogleAuthProvider.GetCredential (
                    "757176116267-71ao5ccoqj1tgu0gdlloke08jj6lsjet.apps.googleusercontent.com"
                    , "");
                auth.SignInWithCredentialAsync (cre).ContinueWith (task => {
                    BaseSocialResult loginResult;

                    if (!task.IsFaulted) {
                        if (task.IsCanceled) {
                            loginResult = new BaseSocialResult (false, "User cancel process");
                            loginResult.IsCancelled = true;
                        } else {
                            loginResult = new BaseSocialResult (true, "Login success");
                        }
                    } else {
                        loginResult = new BaseSocialResult (false, "Login failed : " + task.Exception.ToString());
                    }

                    if (callback != null) {
                        callback (loginResult);
                    }
                });
 

 
But when I build and run on Android it crashed and here is the debug log

02-27 17:50:51.994: I/Unity(6577): InitializationException: Java class com/google/firebase/messaging/cpp/RegistrationIntentService not found.  Please verify the AAR which contains the com/google/firebase/messaging/cpp/RegistrationIntentService class is included in your app.
02-27 17:50:51.994: I/Unity(6577):   at Firebase.FirebaseApp.CreateAndTrack (Firebase.CreateDelegate createDelegate) [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at Firebase.FirebaseApp.Create () [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at Firebase.FirebaseApp.get_DefaultInstance () [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at Firebase.Auth.FirebaseAuth.get_DefaultInstance () [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at NativeUtilities.SocialNative.SocialGoogle.Login (IEnumerable`1 permission, NativeUtilities.SocialNative.SocialDelegate`1 callback) [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at NativeUtilities.SocialNative.SocialManager.Login (System.Collections.Generic.List`1 permission, NativeUtilities.SocialNative.SocialDelegate`1 callback) [0x00000] in <filename unknown>:0 
02-27 17:50:51.994: I/Unity(6577):   at LoginSceneViewController.OnInitCallback (ISocialResul

I had check all the .aar files needed , its all updated to version 10.2.0.

BTW : one more stupid question where can i get googleIdToken and googleAccessToken in order to login to firebase ? 

Stewart Miles

unread,
Feb 27, 2017, 12:01:54 PM2/27/17
to fireba...@googlegroups.com
The stack trace says that you're missing the Android dependencies in your APK.  Run "Assets > Play Services Resolver > Android Resolver > Resolve Client Jars",  perhaps you disabled background resolution?

You can verify the aars are present in the project as they'll be copied under Plugins/Android.

Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/30492b79-7fff-43ac-8d9a-d2d43ad1f00d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lo...@nct.vn

unread,
Feb 27, 2017, 9:50:20 PM2/27/17
to Firebase Google Group
Hi , I had re-import and it's worked :D thanks for your help , but now I got an error due to invalid credential 

The document is :
Firebase.Auth.Credential credential =
   
Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, googleAccessToken);

What is googleIdToken and googleAccessToken ? I cant find it on my firebase console.

Vào 00:01:54 UTC+7 Thứ Ba, ngày 28 tháng 2 năm 2017, Stewart Miles đã viết:
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Stewart Miles

unread,
Feb 28, 2017, 4:22:08 PM2/28/17
to fireba...@googlegroups.com
You need to generate these tokens from Google Sign-In.

If you want to verify sign-in works at all it's probably worth starting with anonymous sign-in then moving on to e-mail / password sign in prior to using a custom credential.

Cheers,
Stewart

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages