Googleplayservicescomponents: ActivityNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInHubActivity

Created on 19 Mar 2017  路  22Comments  路  Source: xamarin/GooglePlayServicesComponents

Xamarin.Android Version (eg: 6.0):

Version: 7.1.0.41

Operating System & Version (eg: Mac OSX 10.11):

Mac OSX 10.12.3

Google Play Services Version (eg: 8.4.0):

Xamarin.GooglePlayServices.Auth 42.1001.0

Describe your Issue:

Unable to find the GoogleSignInHubActivity when using following code:

gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                                                      .RequestIdToken("--mytoken--")
                                                      .Build();
mGoogleApiClient = new GoogleApiClient.Builder(this)        
                          .EnableAutoManage(this, (obj) =>  { Toast.MakeText(this, "Failed login", ToastLength.Long); }) 
                                      .AddApi(Auth.GOOGLE_SIGN_IN_API)
                                      .Build();

Intent signInIntent = Auth.GoogleSignInApi.GetSignInIntent(mGoogleApiClient);
StartActivityForResult(signInIntent, RC_SIGN_IN);

Steps to Reproduce (with link to sample solution if possible):

I'm trying to authenticate to azure mobile services with google login. The current state de SDK for azure mobile services does not allow to directly use it to perform google authentication. I have to pass an access token to it to be able to authenticate. (recently google decided not to allow login trough in app webviews.)

So I've setup a google oauth client in the google console, Added the Xamarin google play services auth packages for xamarin. I've downloaded the google-services.json file and set the build action to GoogleServicesJson, Added the internet permission to my manifesta nd the googleSignIn button to my axml. and now I'm getting this error.

Include any relevant Exception Stack traces, build logs, adb logs:

Unable to find explicit activity class {be.appmigo.kwashy/com.google.android.gms.auth.api.signin.internal.SignInHubActivity}; have you declared this activity in your AndroidManifest.xml?

All 22 comments

I am running into the same issue, did you find a solution to this problem by any chance?

I'm afraid not. Would love to hear from some of the developers here.

As of now I have put in a workaround and added the activity manually to my Manifest. I suspect the manifest merge is failing at some point, but I am not sure where.

Could you show me an example?

I just added this line to the manifest to get it to work.
<activity android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" />

However, this should not be be required. I have not figured out if I am doing something wrong, or its just missing in the library manifest.

Are you building in Visual Studio? I'm trying to reproduce this issue here and haven't been able to (it merges successfully for me into my manifest).

Could you post your final AndroidManifest.xml file?

I take that back, I'm now able to reproduce this. I think this is an issue upstream with Xamarin.Android itself. For now you're going to need to manually add tag to your manifest just as suggested.

In the meantime we've worked around this manually in Xamarin.Build.Download.
https://github.com/xamarin/XamarinComponents/commit/2824d7ed5ee6555bfdf448289b01732e12c51ba9

Basically, we are doing the android:name attribute package name concatenation manually for now until Xamarin.Android supports this.

@michaelgobbers could you try using Xamarin.Build.Download 0.4.4-beta1 and confirming this resolves the issue?

I will try this later tonight when I have some time available.

A bit later then I originally told, but the beta version seems to do the trick.

Thanks for the fix!

Thanks for getting back! Eventually this will be fixed in core Xamarin.Android but for now we'll push this fix out as part of Xamarin.Build.Download 0.4.4 stable (and of course using the 0.4.4-beta1 for now is perfectly fine too).

@Zomb @michaelgobbers @Redth @radical @bratsche
Hi everyone. I get this working. But, When the intent starts, and I choose a google account, It returns to "OnActivityResult" with blank intent i.e. data has nothing in it.
Also, in this case, GoogleSignInResult returns result.Success as false.

protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult (requestCode, resultCode, data);
Log.Debug (TAG, "onActivityResult:" + requestCode + ":" + resultCode + ":" + data);

        if (requestCode == RC_SIGN_IN) {
                        GoogleSignInResult result = Auth.GoogleSignInApi.GetSignInResultFromIntent(data);
                        handleSignInResult(result);
                    }        
    }

Can anybody please help me with this ?
Thanks in advance.

I am experiencing something similar to @JatinKinraAis, asked to choose an account, then gets a canceled result -

resultCode: Canceled
data: Intent { (has extras) }
result.Status.StatusCode: 12501

Can anybody point me in the right direction?

@tibomogul Have you made sure that you flipped on the required switches in the Auth console? There is a separate switch for each authentication method. You also need to make sure that the key that is signing your app is the same key in the firebase cosole (for Android).

@Zomb thank you for your response. I tried several things before posting here. I will circle back to this issue after my deadline, I got another oauth implementation working so I'll go with it for now.

Have you folks installed Xamarin.Build.Download 0.4.4?

I am currently on 0.4.5 and have not had any issues so far. I was on 0.4.3 and did not have any issues with the sign in apart from that manual workaround (which I will remove). I have shot myself in the foot a couple of times though, by not switching the auth type on before trying to use it, and thinking I was signing the apk with one key but actually signing it with another.

Installed Xamarin.Build.Download 0.4.5 but still getting same ActivityNotFoundException for the SignInHubActivity. Workaround still works though.

This is on a multi-dex project if it makes a difference

@austinf @Redth I am using the lastest Xamarin.Build.Download 0.4.5 too, and the ActivityNotFoundException persist.

Thanks, look like there was a small bug still in 0.4.5. We will be publishing 0.4.6 shortly which should fix this. In the meantime please use the manual work around of explicitly adding the activity declaration to your manifest.

oh.. I did it, webID wasn't

Was this page helpful?
0 / 5 - 0 ratings