Skip to content

Fatal Exception on API level below 19 #596

@owenpearson

Description

@owenpearson

A customer has raised an issue whereby aNoClassDefFoundError is thrown because of the use of java.nio.charset.StandardCharset. Full stack trace:

Fatal Exception: java.lang.NoClassDefFoundError
java.nio.charset.StandardCharsets
io.ably.lib.http.HttpUtils.encodeURIComponent (HttpUtils.java:150)
io.ably.lib.realtime.ChannelBase.<init> (ChannelBase.java:1096)
io.ably.lib.realtime.Channel.<init> (Channel.java:14)
io.ably.lib.realtime.AblyRealtime$InternalChannels.get (AblyRealtime.java:164)
io.ably.lib.realtime.AblyRealtime$InternalChannels.get (AblyRealtime.java:147)
com.REDACTED.conversational.managers.ChannelManager$subscribeToProspect$$inlined$let$lambda$1.run (ChannelManager.kt:200)
java.lang.Thread.run (Thread.java:856)

This is essentially the same problem as in issue #332.

This issue is down to the fact that StandardCharsets requires API level 19 or higher. Looking at the codebase StandardCharsets is used in lib/http/HttpUtils.java:150 and lib/types/DecodingContext.java:21. In both cases this can be resolved by replacing StandardCharsets.UTF_8 with Charset.forName("UTF-8") as was done in #332.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. It's clear that this does need to be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions