Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug UnityAds Crash on Android: NPE kotlinx.coroutines.flow.MutableStateFlow.setValue

Discussion in 'Editor & General Support' started by Pedroatg, May 9, 2024.

  1. Pedroatg

    Pedroatg

    Joined:
    Oct 30, 2015
    Posts:
    13
    Hello, we just launched our new game for Android and iOS built with the Unity engine (2022.3.16f1) and we started seeing this crash appearing on Crashlytics.

    Have any of you experience this? Any way to fix it?


    Caused by java.lang.NullPointerException: Attempt to invoke interface method 'void kotlinx.coroutines.flow.MutableStateFlow.setValue(java.lang.Object)' on a null object reference
    at com.unity3d.ads.core.data.repository.AndroidSessionRepository$1.invokeSuspend(AndroidSessionRepository.kt:50)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

    Here is the details from one of the devices


    Fatal Exception: java.lang.Error: FATAL EXCEPTION [DefaultDispatcher-worker-3]
    Unity version : 2022.3.16f1
    Device model : OnePlus OnePlus8Pro
    Device fingerprint: OnePlus/IN2023/OnePlus8Pro:11/QKR1.191246.002/2006701342:user/release-keys
    CPU supported ABI : [x86_64, arm64-v8a, x86, armeabi-v7a, armeabi]
    Build Type : Release
    Scripting Backend : IL2CPP
    Libs loaded from : lib/arm64
    Strip Engine Code : true
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,520
  3. PycuBep

    PycuBep

    Joined:
    Jul 13, 2017
    Posts:
    3
    Same issue. Using Unity Ads version 4.11.2 via mediation.