mixpanel/mixpanel-android

Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId

mtrakal opened this issue ยท 21 comments

    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

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

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

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

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

Thanks for the fix.

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.::)

owolp commented

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")
}

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

yes agree with @yangcheng - would be good to remove this.

Thanks to @MDXDave and @owolp BTW - I was pretty stuck

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

This is actually important since apps will have conflicts with FirebaseMessaging and FirebaseInstanceId.

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

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.

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.

Added these in App's Build gradl dependencies 

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

@omarreess Thanks for this. I already solved my issue.

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.

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

thanks @benpratt22 !

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?

Having same issue with 5.9.5

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'
      }
Added these in App's Build gradl dependencies 

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

It's working for me

@Niel-Torres thank you so damn much. I'm not even using mixpanel, but your solution solved a big problem I've been facing these last few days. Android configs are new to me, but with help like this I'm slowly picking up its env. Thank you again

After adding implementation("com.google.firebase:firebase-iid")
got this error
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.google.firebase:firebase-iid:.