keven
keven

Reputation: 19

Cannot find com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable class

My build.gradle is:

// for facebook account kit
compile 'com.facebook.android:account-kit-sdk:4.+'

// for google firebase database
compile 'com.google.firebase:firebase-database:9.6.0'

// for google firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:9.6.0'

After rebuild project,a error happens.

Error:(74, 27) error: Cannot access AbstractSafeParcelable Cannot find com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable class

==============================================

Resolution:

The reason is that after rebuilding the project, gradle download the latest version of "account-kit-sdk" to 4.25.0, the new version changes some about gms, so make some conflicts with firebase messaging,

So I downgrade the account-kit-sdk version, change import version from "account-kit-sdk:4.+" to "account-kit-sdk:4.24.0"

Then the issue has been resolved.

But I think it is not the best resolution about this problem.

Welcome friends add some new ways to resolve this issue.

Thanks.

Upvotes: 0

Views: 1788

Answers (1)

Bob Snyder
Bob Snyder

Reputation: 38309

Version 4.25.0 of com.facebook.android:account-kit-sdk has a dependency on com.google.android.gms:play-services-auth-api-phone:11.0.1 that is not present in version 4.24.0. com.google.android.gms:play-services-auth-api-phone adds many transitive dependencies on other com.google.android.gms modules, including base, basement, tasks, auth, and auth-base.

The Firebase libraries also have transitive dependencies on numerous com.google.android.gms modules. If the version numbers of all of the Firebase and Play Services modules in a build are not the same, problems such as this one occur.

A simple solution is to use version 11.0.1 of all Firebase and Play Services libraries you list in your gradle dependencies:

// for google firebase database
compile 'com.google.firebase:firebase-database:11.0.1'

// for google firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:11.0.1'

You should also specify a fixed version number for the Facebook library to make your build predictable and repeatable:

compile 'com.facebook.android:account-kit-sdk:4.25.0'

The risk of specifying the version as "4.+" is that when a new version is released that has transitive dependencies on a new version of the Play Services libraries, the new Facebook lib version will be automatically used and your build will break again.

To debug problems like this one, you can open the Gradle window in Android Studio and double-click on :app -> Tasks -> android -> androidDependencies to generate a dependency tree. The tree can then be examined to find version mismatches.

Upvotes: 1

Related Questions