Skip to content

ExceptionInInitializerError on Android 5 #988

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

Closed
Jeff11 opened this issue Feb 16, 2019 · 1 comment
Closed

ExceptionInInitializerError on Android 5 #988

Jeff11 opened this issue Feb 16, 2019 · 1 comment

Comments

@Jeff11
Copy link

Jeff11 commented Feb 16, 2019

kotlin:1.3.21, kotlinx-coroutines-core:1.1.1

I'm getting reports of ExceptionInInitializerError from Android 5 devices.

GlobalScope is used here, because the coroutines should not depend on Android's activity or fragment lifecycle. On other places I'm extending CoroutineScope and don't see crashes there.

When calling await() inside GlobalScope.launch{ }:

Fatal Exception: java.lang.ExceptionInInitializerError
Caused by java.lang.RuntimeException: java.lang.NoSuchFieldException: _decision
       at java.util.concurrent.atomic.AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl.(AtomicIntegerFieldUpdater.java:270)
       at java.util.concurrent.atomic.AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdater.java:49)
       at kotlinx.coroutines.CancellableContinuationImpl.(CancellableContinuationImpl.kt)
       at kotlinx.coroutines.CompletableDeferredImpl.await(CompletableDeferred.kt:70)
       at com.example.MyClass$aNiceFunction$1.invokeSuspend(MyClass.kt:391)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
       at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.access$getSchedulerName$p(CoroutineScheduler.kt:60)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)

And directly when calling GlobalScope.launch(Dispatchers.IO) { }:

Fatal Exception: java.lang.ExceptionInInitializerError
Caused by java.lang.RuntimeException: java.lang.NoSuchFieldException: lastScheduledTask
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.(AtomicReferenceFieldUpdater.java:202)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:67)
       at kotlinx.coroutines.scheduling.WorkQueue.(WorkQueue.kt)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.(CoroutineScheduler.kt:622)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.(CoroutineScheduler.kt:616)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.createNewWorker(CoroutineScheduler.kt:473)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.requestCpuWorker(CoroutineScheduler.kt:401)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.dispatch(CoroutineScheduler.kt:353)
       at kotlinx.coroutines.scheduling.ExperimentalCoroutineDispatcher.dispatchWithContext$kotlinx_coroutines_core(Dispatcher.kt:106)
       at kotlinx.coroutines.scheduling.LimitingDispatcher.dispatch(Dispatcher.kt:158)
       at kotlinx.coroutines.scheduling.LimitingDispatcher.dispatch(Dispatcher.kt:148)
       at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:376)
       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:25)
       at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
       at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160)
       at kotlinx.coroutines.BuildersKt.kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Unknown Source:5)
       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default$28f1ba1(Builders.common.kt:47)
       at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
       at com.example.MyClass2.onPushOpened(MyClass2.kt:42)
       at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source)
       at com.google.android.gms.iid.zzf.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)
@qwwdfsad
Copy link
Member

This is a duplicate of #490.
Please read discussion in that issue, sadly, there is not much we can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants