2

Using Marketing Cloud SDK 8.0.5 I have this crash in some devices:

Fatal Exception: java.lang.NullPointerException: Parameter specified as non-null is null: method com.salesforce.marketingcloud.i$a.a, parameter registrationManager
   at com.salesforce.marketingcloud.i$a.a(i.java:7)
   at com.salesforce.marketingcloud.i.a(i.java:2)
   at com.salesforce.marketingcloud.MarketingCloudSdk.getModuleIdentity(MarketingCloudSdk.java:10)
   at com.salesforce.marketingcloud.sfmcsdk.SFMCSdk$Companion.configure$lambda-14$lambda-13$lambda-8$lambda-5(SFMCSdk.kt:150)
   at com.salesforce.marketingcloud.sfmcsdk.SFMCSdk$Companion.$r8$lambda$9fQipfNAkp2AOEMdahsy0roqffs(SFMCSdk.kt)
   at com.salesforce.marketingcloud.sfmcsdk.SFMCSdk$Companion$$InternalSyntheticLambda$0$8f17141e8f91a3f0663c4144b1bd32e8b5f3838f5cf69f7eb91aa8072e1e44aa$0.ready(SFMCSdk.java:4)
   at com.salesforce.marketingcloud.sfmcsdk.modules.Module$initModule$1.execute$lambda-2(Module.kt:88)
   at com.salesforce.marketingcloud.sfmcsdk.modules.Module$initModule$1.$r8$lambda$-z9qKHA8ZN8MYYHlpqIIh3FSq2o(Module.kt)
   at com.salesforce.marketingcloud.sfmcsdk.modules.Module$initModule$1$$InternalSyntheticLambda$0$a9ccaa4621430f4a20b72d9d6223c2798f30eb8694f16abbc906d2e40f3878bc$0.ready(Module.java:8)
   at com.salesforce.marketingcloud.MarketingCloudConfig.init$lambda-1$lambda-0(MarketingCloudConfig.java:10)
   at com.salesforce.marketingcloud.MarketingCloudConfig.$r8$lambda$25aa8nzHyD48ZQhtsfuMOIgwk9k(MarketingCloudConfig.java)
   at com.salesforce.marketingcloud.MarketingCloudConfig$$InternalSyntheticLambda$0$fd28dbe42c7193cdb46aabc26de2507772f2bf4a93f33bd428692807e1c948cb$0.ready(MarketingCloudConfig.java:4)
   at com.salesforce.marketingcloud.MarketingCloudSdk$b.a(MarketingCloudSdk.java:4)
   at com.salesforce.marketingcloud.MarketingCloudSdk$c$a.run(MarketingCloudSdk.java:15)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loopOnce(Looper.java:226)
   at android.os.Looper.loop(Looper.java:313)
   at android.app.ActivityThread.main(ActivityThread.java:8669)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Do you know what could be going on?

Editing:

We have implemented the workaround suggested, but the crash is not fixed yet. We are using the code:

SFMCSdk.requestSdk { sdk ->
            sdk.mp {
                sdk.identity.run { ... // code using the Identity// ... }
            }
}

This is the only place of our code when we call the function SFMCSdk.requestSdk, we have other places where we call the function MarketingCloudSdk.requestSdk, we don't know if we need to change it as well.

Do you have any clue why the crash is still there?

Thanks for your support.

3 Answers 3

1

We were experiencing this crash, and it turned out we were configuring the SDK in multiple locations. Depending on timing, sometimes we would be trying to use the listener passed to SFMCSdk.configure() while a subsequent configure() was in progress. Eliminating the extra configure() calls fixed the issue.

1
  • This could be the reason as we are calling this function twice, I will take a look to call it only once and see if the bug disappears as in your case. thanks for your comment.
    – Rubén
    Commented Dec 22, 2022 at 17:47
5

This typically happens when you're initializing the SFMCSdk, but then directly accessing the MarketingCloudSdk. Please use:

SFMCSdk.requestSdk {
  it.mp { push ->
    // push.doStuff
  }
}
5
  • 1
    Yep I'm calling requestSDK and using SFMCSdk directly (it in your sample code). I'll do it as you tell me. Thanks Bill.
    – Rubén
    Commented Aug 24, 2022 at 8:21
  • hello, we did those changes and we still have this crash, maybe we misunderstood what we have to do, we have edited the question with the changes we did, is this enough? thank you very much for your help
    – Rubén
    Commented Sep 29, 2022 at 7:40
  • 1
    We have no other reports of this. Try updating to 8.0.7 and/or open a support case.
    – Bill Mote
    Commented Sep 29, 2022 at 15:01
  • 1
    all right, we will update that and see if the crash disappears
    – Rubén
    Commented Sep 30, 2022 at 8:31
  • 1
    jfyi we released a new version of our app, but we need some time to check if that solves the crash
    – Rubén
    Commented Oct 11, 2022 at 11:29
0

I updated to the newest version of marketing cloud, handled exceptions, refactored the application imagining it to be the moment of calling the sdk, but still without success.

Crash can only be reproduced on some devices with developer mode enabled, app in background.

Any idea?

1
  • Welcome to Salesforce Stack Exchange (SFSE)! This is a Questions & Answers site, not a threaded forum. Please see the various pertinent/relevant notes in Why and how are some answers deleted?, and be aware that your "answer" will likely be deleted. You can contribute in other ways to earn enough rep so that you can comment; or you could possibly ask a new question, and in it you can link to this question or its other answer for reference if helpful.
    – Moonpie
    Commented Nov 30, 2022 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .