0

I'm using com.salesforce.marketingcloud:marketingcloudsdk:8.0.3 and I have the following crash in some devices:

java.lang.IllegalStateException: 
 at com.salesforce.marketingcloud.MarketingCloudSdk.getInstance (Unknown Source:13)

Could someone help me?

0

1 Answer 1

1

I suspect you're not initializing the SDK in your application's onCreate() method and/or you're delaying/preventing the SDK from being initialized.

Also, if you're application is calling getInstance() I would suggest refactoring it to use requestSdk().

@Nullable @MCKeep public static MarketingCloudSdk getInstance() {
    if (!isInitializing && !isReady) {
      throw new IllegalStateException(
          "MarketingCloudSdk#init must be called before calling MarketingCloudSdk#getInstance.");
    }```
3
  • Thank you for your reply. I checked it and I',m initializing the SDK in my app's onCreate() method just like with the version 7, but I didn't have this crash with version 7. And, about using requestSdk() instead of getInstance(), is there a link with more info about it? I just did theese migration steps: SFMCSdk Migration
    – Rubén
    Commented Nov 22, 2021 at 16:50
  • 1
    getInstance() is a blocking call and discouraged.
    – Bill Mote
    Commented Nov 23, 2021 at 1:19
  • If you need further assistance you should open a support ticket through your account manager.
    – Bill Mote
    Commented Nov 23, 2021 at 13:26

You must log in to answer this question.

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