I am following Google's documentation for Google Sign. Having a weird problem when I call
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent (mGoogleApiClient);
startActivityForResult (signInIntent, RC_SIGN_IN);
Its seems Intent has been fired but I can't see account picker dialog. I am using
compile "com.google.android.gms:play-services-auth:9.6.1"
When I check does googleclient object is connected, it returns true.
It's working in some of the devices, but not on every device(specially xiaomi)
Implementation
@OnClick (R.id.google_singin_button)
void signInButtonClicked () {
HashMap<String, Object> map = new HashMap<> ();
map.put (AllAnalytics.LABEL, AllAnalytics.Label.SIGN_IN_GOOGLE);
map.put (AllAnalytics.ACTION, AllAnalytics.Action.CLICK);
map.put (AllAnalytics.CATEGORY, AllAnalytics.Category.REGISTRATION_SCREEN);
aa.analyticsEventOccur (map);
if (null != mGoogleApiClient) {
// Log.e(TAG,mGoogleApiClient.isConnected()+"");
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent (mGoogleApiClient);
startActivityForResult (signInIntent, RC_SIGN_IN);
}
}
@Override
public void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult (requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if(Activity.RESULT_CANCELED != resultCode)
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent (data);
handleSignInResult (result);
}
}
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
mActivity = (RegisterActivity) getActivity ();
GoogleSignInOptions gso
= new GoogleSignInOptions.Builder (GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestServerAuthCode (getString (R.string.google_client_auth), false)
.requestEmail ()
.build ();
mGoogleApiClient = new GoogleApiClient.Builder (getContext ())
.enableAutoManage (mActivity , this)
.addApi (Auth.GOOGLE_SIGN_IN_API, gso)
.build ();
}
Log Cat
Class not found when unmarshalling: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at java.lang.Class.forName(Class.java:273)
at android.os.Parcel.readParcelableCreator(Parcel.java:2281)
at android.os.Parcel.readParcelable(Parcel.java:2245)
at android.os.Parcel.readValue(Parcel.java:2152)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.containsKey(BaseBundle.java:269)
at android.content.Intent.hasExtra(Intent.java:4884)
at com.miui.server.XSpaceManagerService.isPublicIntent(XSpaceManagerService.java:174)
at com.android.server.am.ActivityStackSupervisorInjector.checkXSpaceControl(ActivityStackSupervisorInjector.java:56)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:897)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3478)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3465)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2245)
at android.os.Binder.execTransact(Binder.java:446)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.signin.internal.SignInConfiguration" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at java.lang.Class.forName(Class.java:273)
at android.os.Parcel.readParcelableCreator(Parcel.java:2281)
at android.os.Parcel.readParcelable(Parcel.java:2245)
at android.os.Parcel.readValue(Parcel.java:2152)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.containsKey(BaseBundle.java:269)
at android.content.Intent.hasExtra(Intent.java:4884)
at com.miui.server.XSpaceManagerService.isPublicIntent(XSpaceManagerService.java:174)
at com.android.server.am.ActivityStackSupervisorInjector.checkXSpaceControl(ActivityStackSupervisorInjector.java:56)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:897)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3478)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3465)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2245)
at android.os.Binder.execTransact(Binder.java:446)
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
10-11 23:46:17.873 1387-4537/? E/JavaBinder: *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
java.lang.RuntimeException: Parcel android.os.Parcel@33c1f490: Unmarshalling unknown type code 6684783 at offset 320
at android.os.Parcel.readValue(Parcel.java:2228)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.containsKey(BaseBundle.java:269)
at android.content.Intent.hasExtra(Intent.java:4884)
at com.miui.server.XSpaceManagerService.shouldResolveAgain(XSpaceManagerService.java:145)
at com.android.server.am.ActivityStackSupervisorInjector.resolveXSpaceIntent(ActivityStackSupervisorInjector.java:68)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:898)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3478)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3465)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2245)
at android.os.Binder.execTransact(Binder.java:446)
10-11 23:46:17.873 1387-4537/? A/ActivityManager: Activity Manager Crash
java.lang.RuntimeException: Parcel android.os.Parcel@33c1f490: Unmarshalling unknown type code 6684783 at offset 320
at android.os.Parcel.readValue(Parcel.java:2228)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.containsKey(BaseBundle.java:269)
at android.content.Intent.hasExtra(Intent.java:4884)
at com.miui.server.XSpaceManagerService.shouldResolveAgain(XSpaceManagerService.java:145)
at com.android.server.am.ActivityStackSupervisorInjector.resolveXSpaceIntent(ActivityStackSupervisorInjector.java:68)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:898)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3478)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3465)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2245)
at android.os.Binder.execTransact(Binder.java:446)
Just check your onActivityResult() is called or not because you have used Fragment. So you have to pass the Activity result from activity to fragment.
In your RegisterActivity you have to write this
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
fragment.onActivityResult(requestCode, resultCode, data);
}
and then you will receive result in your Fragment.
Hope it helps you.
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