Attempt to invoke virtual method 'EkoPushContractWrapper.getPushContract()' on a null object reference

Hello, we are experiencing crashes for some users when Firebase onNewToken is triggered. Our implementation is similar to what can be found in samples in AmitySampleFirebaseMessagingService and looks like this:

    override fun onNewToken(token: String) {
        AmityFcm.create()
            .setup(token)
            .subscribe(
                { Timber.i("fcm_new_token onNewToken success") },
                { Timber.e("fcm_new_token onNewToken: $it error") },
            )
    }

and for some users we are experiencing NullPointers

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.amity.socialcloud.sdk.push.EkoPushContract com.amity.socialcloud.sdk.push.EkoPushContractWrapper.getPushContract()' on a null object reference
       at com.amity.socialcloud.sdk.push.AmityFcm.setup(AmityFcm.java:24)

Most crashes are marked as Early crashes on Crashlytic meaning they occur within 5s from app startup. Any idea what can be reason of having null EkoPushContractWrapper?

Hello @m445, could you please let us know your current Android SDK/UIkit versions?

Additionally, did this issue just start occurring, or did it begin after you updated to the version?

We forked android UIkit with version 3.1.0. Our current Amity messaging service is 6.16.1. Issue happens from the beginning, we have updated amity for a while

@m445 thank you for confirming - let us pass to the team to further check.

Hello @m445, this error may occur if the AmityCoreClient.setup() process hasn’t been fully completed.

We recommend checking the implementation of AmityCoreClient.setup(). To prevent race conditions, please ensure that AmityCoreClient.setup() should be called once in Application class.