从 Google+ 登录切换到新的 Google 登录会导致 BadParcelableException

Switching from Google+ Sign-In to the new Google Sign-In causes a BadParcelableException

作为 Google Play Servies 8.3.0 的一部分,我从 Google+ 登录切换到新的 Google Sign-In 并获得:

BadParcelableException: Parcelable protocol requires a Parcelable.Creator object called CREATOR on class com.google.android.gms.auth.TokenDat

在:

GoogleAuthUtil.getToken(getApplicationContext(), email, scopes);

如何防止 BadParcelableException?

您必须通过添加以下内容来防止 ProGuard/DexGuard 在新的 com.google.android.gms.auth 包中剥离所需的 类:

-keep public class com.google.android.gms.auth.** { public *; }

到您的 proguard-project.txtdexguard-project.txt 文件。