mixpanel-android: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId

    implementation 'com.mixpanel.android:mixpanel-android:5.9.1'

    // Firebase
    implementation platform('com.google.firebase:firebase-bom:28.0.1')

    implementation 'com.google.firebase:firebase-messaging'
    implementation "com.google.firebase:firebase-config"
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-dynamic-links'
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-database-ktx'
    implementation 'com.google.firebase:firebase-firestore-ktx'
    implementation 'com.google.firebase:firebase-crashlytics'

Crash on startapp

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
        at com.mixpanel.android.mpmetrics.MixpanelFCMMessagingService.init(MixpanelFCMMessagingService.java:84)
        at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:655)
        at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:536)
        at myapp.App.onCreate(App.kt:52)

myapp.App.onCreate(App.kt:52):

MixpanelAPI.getInstance(this, BuildConfig.MIXPANEL_TOKEN)

Firebase: 28.0.1 don’t contain FirebaseInstanceId at all. It was deprecated a few versions ago. You should use: FirebaseMessaging.getToken() for messaging or FirebaseInstallations for app instance identifiers. More info: https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 24
  • Comments: 21

Most upvoted comments

You can fix this issue by adding the firebase-iid dependency:

implementation("com.google.firebase:firebase-iid")
Added these in App's Build gradl dependencies 

implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation("com.google.firebase:firebase-iid")

Thank you @MDXDave for the workaround. I’ve also added an explanation to the implementation

implementation("com.google.firebase:firebase-iid") {
        because("https://github.com/mixpanel/mixpanel-android/issues/744")
}

Check that you have these dependences in “build.gradle”:

Android>App>build.gradle

      dependences{
         implementation platform('com.google.firebase:firebase-bom:29.0.1')
         implementation('com.google.firebase:firebase-iid')
         implementation 'com.google.firebase:firebase-messaging'
      }

Android>build.gradle

      dependences{
          classpath 'com.android.tools.build:gradle:4.2.1'
          classpath 'com.google.gms:google-services:4.3.10'
          classpath 'com.google.firebase:firebase-messaging:21.0.1'
      }

Thanks for bringing it up. We will address this issue as a priority.

I’m still getting this issue on 5.9.4 and 5.9.5:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;

Adding the dependency manually fixes the issue still, but I thought this was fixed correctly by Mixpanel?

Add this line into implementation section (android/app/build.gradle) dependencies { implementation “com.google.firebase:firebase-iid” }

Thanks @MDXDave for letting know this to everyone. I appreciate you’re valuable time.:😃

when can we expect a proper fix by removing the deprecated dependency ?

Just in case somebody else lands here, v5.9.2 has an issue, use 5.9.4 and it works! Thanks @zihejia

We have released v5.9.4 which has the fix for the missing dependency. We are deprecating Messaging and Mobile A/B testing features(more details) so the FCM service will be removed soon from our SDK. I’m closing this one now, please feel free to raise any questions.

You can fix this issue by adding the firebase-iid dependency:

implementation("com.google.firebase:firebase-iid")

Much thanks. Solved the issue which was keeping me to upgrade dependencies appwide. Much thanks.

I don’t know how to thank you. You solve my issue which I have been facing for more than 2 weeks. I added the dependency and it worked. Thanks again.