braze-android-sdk icon indicating copy to clipboard operation
braze-android-sdk copied to clipboard

[Bug]: Crash - NoSuchFieldError - No static field Key of type CoroutineExceptionHandler

Open eloisance opened this issue 1 year ago • 7 comments

Braze Android SDK Version

30.0.0

Steps To Reproduce

Couldn't reproduce

Expected Behavior

Not crashing the app

Actual Incorrect Behavior

Crashing the app

Verbose Logs

Fatal Exception: java.lang.NoSuchFieldError: No static field Key of type Lkotlinx/coroutines/CoroutineExceptionHandler$Key; in class Lkotlinx/coroutines/CoroutineExceptionHandler; or its superclasses (declaration of 'kotlinx.coroutines.CoroutineExceptionHandler' appears in base.apk)
       at com.braze.coroutine.BrazeCoroutineScope.<clinit>(SourceFile:1)
       at com.braze.images.DefaultBrazeImageLoader.initDiskCacheTask(SourceFile:1)
       at com.braze.images.DefaultBrazeImageLoader.<init>(SourceFile:9)
       at com.braze.Braze.<init>(SourceFile:49)
       at com.braze.Braze$Companion.getInstance(SourceFile:4)
       at fr.vestiairecollective.BaseApplication.initBraze(BaseApplication.kt:385)
       at fr.vestiairecollective.BaseApplication.onCreate(BaseApplication.kt:105)
       at fr.vestiairecollective.app.VestiaireApplication.onCreate(VestiaireApplication.kt:27)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
       at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:2)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
       at android.app.ActivityThread.access$1100(ActivityThread.java:199)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6669)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Additional Information

Since we have upgrade the SDK to the latest version 30.0.0 we are noticing some crash only for Rooted, Unknown device - GCE X86 Phone, Android 9

Screenshot at Feb 22 10-53-14

eloisance avatar Feb 22 '24 09:02 eloisance

  1. Please post your gradle app dependency tree ./gradlew app:dependencies
  2. What version of kotlin coroutines are you using?

radixdev avatar Feb 22 '24 18:02 radixdev

Hi @radixdev

Thanks for your quick reply.

  1. Can you be a bit a more specific about this, we would like to avoid sharing our entire dependency tree.
  2. We are using Kotlin coroutines version 1.8.0

eloisance avatar Feb 23 '24 15:02 eloisance

  1. We can move this to [email protected] in order to avoid sharing the necessary info in this public setting.
  2. The crash seems to be coming from inside the coroutines library itself and implies some proguard/r8 mishap. We can also gather that info in a more secure setting image

radixdev avatar Feb 23 '24 16:02 radixdev

@radixdev We have also similar crash on 24.2.0 Here is the partial stack trace:

Fatal Exception: java.lang.IncompatibleClassChangeError: Class kotlinx.coroutines.b2 implements non-interface class kotlinx.coroutines.w (declaration of 'kotlinx.coroutines.b2' appears in /data/app/~~nO8zurTIQqcq4xDRyC6PEA==/org.gamatech.androidclient.app-dVcnEj1t6Na24Qhc2SwQXA==/base.apk!classes3.dex)
       at kotlinx.coroutines.SupervisorKt.SupervisorJob(Supervisor.kt:33)
       at kotlinx.coroutines.SupervisorKt.SupervisorJob$default(Supervisor.kt:33)
       at com.braze.coroutine.BrazeCoroutineScope.<clinit>(SourceFile:6)
       at com.braze.images.DefaultBrazeImageLoader.initDiskCacheTask(SourceFile:1)
       at com.braze.images.DefaultBrazeImageLoader.<init>(SourceFile:9)
       at com.braze.Braze.<init>(SourceFile:46)

We can share a full stack trace if needed.

yarodevuci avatar Feb 23 '24 19:02 yarodevuci

Similar crash for version "com.appboy:android-sdk-ui:24.3.0"

Here is the partial stack trace:

Caused by java.lang.NoSuchFieldError: No field Key of type Lkotlinx/coroutines/CoroutineExceptionHandler$Key; in class Lkotlinx/coroutines/CoroutineExceptionHandler; or its superclasses (declaration of 'kotlinx.coroutines.CoroutineExceptionHandler' appears in /data/app/~~eeq_LnkvDmbh5kjBzdRwNQ==/androidx.test.tools.crawler-88OUb8Xa60vtI8BSBXoWiA==/base.apk) at com.braze.coroutine.BrazeCoroutineScope.(SourceFile:1) at com.braze.images.DefaultBrazeImageLoader.initDiskCacheTask() at com.braze.images.DefaultBrazeImageLoader.(SourceFile:9) at com.braze.Braze.(SourceFile:46) at com.braze.Braze$Companion.getInstance(SourceFile:4)

RitaBags avatar Mar 27 '24 18:03 RitaBags

Hi @radixdev I just sent an email to your support email address with the full dependency tree. Hope this will help. Thanks

eloisance avatar Apr 03 '24 08:04 eloisance

Hi @RitaBags, your issue might be different and more relevant to this thread: https://stackoverflow.com/questions/78041019/google-play-testing-app-crash-java-lang-nosuchfielderror-no-field-key-of-type/78064831#comment137776357_78064831. Please let us know if you still experience it or have more questions. Thanks.

jocelynzz avatar Apr 04 '24 18:04 jocelynzz

Closing this issue for now. Please let us know if this can be reproduced as an SDK issue and not a bug with the coroutines library itself.

radixdev avatar Aug 15 '24 15:08 radixdev