Skip to content

Missing Proguard rules? Crash at 'java.lang.NoSuchFieldException: No field result in class Lkotlin/f/i;' #1694

Closed
@fightyz

Description

@fightyz

I'm using Kotlin coroutine 1.3.2, and my app is obfuscated. When I using coroutines, I get the following crash stack:

java.lang.RuntimeException: java.lang.NoSuchFieldException: No field result in class Lkotlin/f/i;
java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:338)
	at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:109)
	at kotlin.coroutines.SafeContinuation.<clinit>(SourceFile:31)

According to the mapping file, the class Lkotlin/f/i is actually SafeContinuation. I look into SafeContinuation, there is a field named result, and it is volatile.

I also noticed that the Kotlin extension library's proguard file has kept all volatile field. So I guess it is also necessary to keep all volatile in Kotlin's stdlib?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions