Skip to content

Google Sign-In throws an exception on Android, while it works as expected on iOS #38

@ronmara

Description

@ronmara

Issue Summary
Google Sign-In throws an exception on Android, while it works as expected on iOS.

Steps to Reproduce
Calling the following line on Android triggers the exception:

GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnAuthenticationFinished, TaskScheduler.FromCurrentSynchronizationContext());

Observed Behavior
On Android, the following exception is thrown:

System.TypeInitializationException: The type initializer for 'Google.Impl.GoogleSignInImpl' threw an exception.
---> UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.googlesignin.GoogleSignInHelper

Expected Behavior
Google Sign-In should work correctly on Android, as it does on iOS.

Environment
Unity Version: 6000.1.4f1

Additional Context
If relevant, the app is also using Firebase and initializing it on startup with the following code:

await FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
    var dependencyStatus = task.Result;
    if (dependencyStatus == DependencyStatus.Available)
    {
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
        FirebaseApp app = FirebaseApp.DefaultInstance;
        Crashlytics.ReportUncaughtExceptionsAsFatal = true;
        IsFirebaseIntialized = true;
    }
    else
    {
        Debug.LogError($"Could not resolve all Firebase dependencies: {dependencyStatus}");
        IsFirebaseIntialized = false;
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions