question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchMethodError: No virtual method getDeclaredAnnotation on Android API level <24

See original GitHub issue

Describe the bug

java.lang.NoSuchMethodError: No virtual method getDeclaredAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; in class Ljava/lang/Class; or its super classes (declaration of 'java.lang.Class' appears in /system/framework/core-libart.jar)
        at kotlinx.serialization.internal.PlatformKt.polymorphicSerializer(Platform.kt:70)
        at kotlinx.serialization.internal.PlatformKt.constructSerializerForGivenTypeArgs(Platform.kt:53)
        at kotlinx.serialization.internal.PlatformKt.compiledSerializerImpl(Platform.kt:23)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializerOrNull(Serializers.kt:129)
        at kotlinx.serialization.SerializersKt.serializerOrNull(Unknown Source)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializerByKTypeImpl$SerializersKt__SerializersKt(Serializers.kt:65)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializer(Serializers.kt:51)
        at kotlinx.serialization.SerializersKt.serializer(Unknown Source)
        at kotlinx.serialization.SerializersKt__SerializersKt.builtinSerializerOrNull$SerializersKt__SerializersKt(Serializers.kt:76)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializerByKTypeImpl$SerializersKt__SerializersKt(Serializers.kt:66)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializer(Serializers.kt:51)
        at kotlinx.serialization.SerializersKt.serializer(Unknown Source)
        at com.example.myapplication.MainActivity.onCreate(MainActivity.kt:17)

Related issue with resolution

To Reproduce On Android API level <24:

Json.decodeFromString<List<Int>>("[0,1,2,3]")

Environment

  • Kotlin version: 1.4.0
  • Library version: 1.0.0-RC
  • Kotlin platforms: JVM (Android)
  • Gradle version: 6.1.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
sandwwraithcommented, Sep 4, 2020

@webfrea-k We plan to release RC2 with this fix soon

9reactions
qwwdfsadcommented, Sep 14, 2020

~this week

Read more comments on GitHub >

github_iconTop Results From Across the Web

No virtual method contains(I)Z in class Landroid/util ...
NoSuchMethodError : No virtual method contains(I)Z in class Landroid/util/SparseArray; ; class PostViewFragment : DialogFragment() { private var ...
Read more >
Class - Android Developers
Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are ... Added in API...
Read more >
Seemingly random "NoSuchMethodError: No virtual method"
During runtime, some function will throw a 'NoSuchMethodError' despite it clearly existing in the codebase. It seems to happen to completely random ...
Read more >
No virtual method elapsedNow()D in class Lkotlin ... - YouTube
Android : java.lang. NoSuchMethodError : No virtual method elapsedNow()D in class Lkotlin/time/TimeMark [ Beautify Your Computer ...
Read more >
Android crash due to "No virtual method ... - Wikitude
NoSuchMethodError : No virtual method ... handleCallback(Handler.java:873) at android.os.Handler. ... Method.invoke(Native Method) at com.android.internal.os.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found