Skip to content

NoSuchMethodError on Android: Unsafe.getByte #18

@Alexander--

Description

@Alexander--

Using the library on some Android versions results in following Error:

java.lang.NoSuchMethodError: No virtual method getByte(Ljava/lang/Object;J)B in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
                  at net.openhft.hashing.LongHashFunction.<clinit>(LongHashFunction.java:73)

It does work on Android 7. It seems, older Android versions do not implement full functionality of Unsafe.

Considering that Unsafe is likely to be replaced/killed off in future versions of mainline Java, you should probably move all related static constants into the UnsafeAccess and add some handling for situations when it is not available.

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