Leanplum/Leanplum-Android-SDK

Error getting FCM token

root-ansh opened this issue · 1 comments

not sure if i missed any step or additional library in here, but am getting this error, can you please help?

2022-06-23 16:38:16.618 21797-21860/work.curioustools.r2d2 E/[Leanplum][ERROR]: Error getting FCM token
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessaging;
        at com.leanplum.Present.updateRegistrationId(SourceFile:1)
        at com.leanplum.FirebaseUtilKt.updateRegistrationId(SourceFile:1)
        at com.leanplum.LeanplumFcmProvider.updateRegistrationId(SourceFile:1)
        at com.leanplum.PushProviders$1.run(PushProviders.java:87)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.FirebaseMessaging" on path: DexPathList[[zip file "/data/app/~~sLdIuTdwKQ5G_C2z1G_wjw==/work.curioustools.r2d2-gNtPSXM_SBdFbgMexKSnOg==/base.apk"],nativeLibraryDirectories=[/data/app/~~sLdIuTdwKQ5G_C2z1G_wjw==/work.curioustools.r2d2-gNtPSXM_SBdFbgMexKSnOg==/lib/arm64, /system/lib64, /system_ext/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.leanplum.Present.updateRegistrationId(SourceFile:1) 
        at com.leanplum.FirebaseUtilKt.updateRegistrationId(SourceFile:1) 
        at com.leanplum.LeanplumFcmProvider.updateRegistrationId(SourceFile:1) 
        at com.leanplum.PushProviders$1.run(PushProviders.java:87) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 

Expected Behavior

user to show fcm as integrated in the app

Actual Behavior

app working but getting this suppressed error in logs . also the user created on dashboard doesn' seem to have fcm enabled for them
image

Steps to Reproduce the Problem

  1. create new project with custom application class
  2. in gradle.properties, add android.enableJetifier=true
  3. in application level build.gradle, add the following dependencies:
dependencies {
  
  //android
  implementation "com.android.installreferrer:installreferrer:2.2"//Mandatory for CleverTap Android SDK v3.6.4
  
  //androidx
  implementation "androidx.annotation:annotation:1.2.0"
  implementation "androidx.appcompat:appcompat:1.4.0"
  implementation "androidx.constraintlayout:constraintlayout:2.1.2"
  implementation "androidx.core:core-ktx:1.7.0"
  implementation "androidx.legacy:legacy-support-v4:1.0.0"
  implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
  implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
  implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
  implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
  implementation "androidx.recyclerview:recyclerview:1.2.1"
  implementation "androidx.viewpager:viewpager:1.0.0"
  
  //jetbrains
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.1"
  
  //google
  implementation "com.google.android.material:material:1.6.1"
  implementation "com.google.android.gms:play-services-location:18.0.0"//for lp//same as ct
  implementation "com.google.android.exoplayer:exoplayer:2.15.1"
  
  //google-firebase
  implementation platform("com.google.firebase:firebase-bom:25.10.0")
  implementation "com.google.firebase:firebase-analytics-ktx"

  // 3rd party
  implementation "com.github.bumptech.glide:glide:4.12.0"

  //leanplum
  implementation("com.leanplum:leanplum-core:5.10.3")
  implementation("com.leanplum:leanplum-fcm:5.10.3")
  implementation("com.leanplum:leanplum-location:5.10.3")



  //test
  testImplementation "junit:junit:4.13.2"
  androidTestImplementation "androidx.test.ext:junit:1.1.3"
  androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
  1. in application class's on create ,call this function:
fun initSDKInApplication(app: Application) {
      Leanplum.setApplicationContext(app);
      Parser.parseVariables(app);

      LeanplumActivityHelper.enableLifecycleCallbacks(app);

      if (BuildConfig.DEBUG) {
          Leanplum.setAppIdForProductionMode("app_4E1oVqnj8hvB2KmrAXRS5M6STH1fQGy3RvuhSQM73ew", "prod_be2EraPzw8kcAjdwXogxsXaEu3aSXABQUt8WDiYrShU")
          //Leanplum.setAppIdForDevelopmentMode("app_4E1oVqnj8hvB2KmrAXRS5M6STH1fQGy3RvuhSQM73ew", "dev_ggCy2JYsAMpoZBVEnuDQwiaLfgfQsCckSazYWlSIgns")
      }else {
          Leanplum.setAppIdForProductionMode("app_4E1oVqnj8hvB2KmrAXRS5M6STH1fQGy3RvuhSQM73ew", "prod_be2EraPzw8kcAjdwXogxsXaEu3aSXABQUt8WDiYrShU")
      }
      Leanplum.trackAllAppScreens();

      Leanplum.setLocale("")

      Leanplum.setLogLevel(Log.Level.DEBUG)
      Leanplum.start(app)

  }

Specifications

  • Version:5.10.3
  • Platform: android(native)
  • Subsystem: ??

works after adding implementation "com.google.firebase:firebase-messaging"