Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moloco Adapter Crash - ClassCastException in SharedPreferences #474

Open
alireza-sunday opened this issue Jan 31, 2025 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@alireza-sunday
Copy link

MAX Plugin Version

8.0.1

Unity Version

2022.3.27f1

Device/Platform Info

Android

Crashes/ANRs per Day

1% of users

Percentage of Users Affected

1

First Occurrence of Crash/ANR

We are experiencing a crash in the Moloco adapter used in AppLovin MAX mediation in our Unity project. The crash occurs due to a ClassCastException when attempting to retrieve a value from SharedPreferences as an Integer, but it appears to have been stored as a Boolean.

FYI, we are using Google UMP (com.google.android.ump:user-messaging-platform:2.2.0) and Moloco adapter(com.applovin.mediation:moloco-adapter:3.4.0.0)

Exception and Stack Trace

      Caused by java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Integer
   at android.app.SharedPreferencesImpl.getInt(SharedPreferencesImpl.java:321)
   at com.moloco.sdk.publisher.privacy.MolocoPrivacyKt.gdprApplies(SourceFile:10)
   at com.moloco.sdk.publisher.privacy.MolocoPrivacyKt.access$gdprApplies(SourceFile:1)
   at com.moloco.sdk.publisher.privacy.MolocoPrivacy.getPrivacySettings(SourceFile:6)
   at com.moloco.sdk.internal.services.bidtoken.s.getPrivacy(SourceFile:1)
   at com.moloco.sdk.internal.services.bidtoken.q.<init>(SourceFile:15)
   at com.moloco.sdk.internal.services.bidtoken.p$a.a(SourceFile:6)
   at com.moloco.sdk.internal.services.bidtoken.m$a.a(SourceFile:4)
   at com.moloco.sdk.internal.services.bidtoken.m$a.invoke(SourceFile:1)
   at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
   at com.moloco.sdk.internal.services.bidtoken.m.b(SourceFile:1)
   at com.moloco.sdk.internal.services.bidtoken.m.a(SourceFile:1)
   at com.moloco.sdk.publisher.Moloco$bidTokenHandler$2.invoke(SourceFile:1)
   at com.moloco.sdk.publisher.Moloco$bidTokenHandler$2.invoke(SourceFile:2)
   at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
   at com.moloco.sdk.publisher.Moloco.getBidTokenHandler(SourceFile:1)
   at com.moloco.sdk.publisher.Moloco.access$getBidTokenHandler(SourceFile:1)
   at com.moloco.sdk.publisher.Moloco$getBidToken$1.invokeSuspend(SourceFile:3)
   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)

How to Reproduce

not reproducible locally, but we see the crash on Crashlytics reports for different apps

Reproducible in the demo app?

Not Tested

Additional Info

No response

@alireza-sunday alireza-sunday added the bug Something isn't working label Jan 31, 2025
@thomasmso
Copy link
Member

Thanks for reporting @alireza-sunday, we'll let Moloco know.

@applovinAsh applovinAsh self-assigned this Feb 1, 2025
@alireza-sunday
Copy link
Author

Hi @thomasmso , Any updates on this issue?

From what I understand, it looks like the Moloco SDK is expecting an incorrect data type when retrieving consent values stored by Google UMP/CMP.

Just a general question: which version of Google UMP do you recommend using? I see that your dependency files specify v2.+, but I noticed that there are newer versions available(https://developers.google.com/admob/android/privacy/release-notes).

@yamir-godil
Copy link

Hi @alireza-sunday ,

Thanks for flagging this issue. Moloco can put a workaround to avoid this hassle of happening in future in one of our next updates. However this is happening because the app has a dependency which isn't following IAB specifications. As per the specification, framework is expected to be working with Ints (which the Moloco SDK expects) - InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework#340 (comment)

Image

@alireza-sunday
Copy link
Author

hi @yamir-godil

Thanks for your response and for considering a workaround in a future update.

Could you clarify what you mean by "the app has a dependency which isn't following IAB specifications"? When you mention "app" and "framework," are you referring to Google UMP, the Moloco SDK, or our app that integrates them?

We are using Google UMP/CMP as our consent management platform without any modifications, and as far as we know, it’s an industry-standard tool. If there's a specific integration issue on our side, we’d appreciate more details so we can investigate further.

Looking forward to your clarification. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants