triniwiz / triniwiz/nativescript-plugins

nativescript-socketio crashes on Android 11+

Open
#99 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
87
Forks
57
Avg merge
1h 36m
Merged PRs (30d)
4

Description

nativescript-socketio crashes on Android 11+:

An uncaught Exception occurred on "EventThread" thread.
null

StackTrace:
java.lang.ExceptionInInitializerError
	at okhttp3.internal.platform.Platform.get(Platform.java:85)
	at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
	at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
	at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202)
	at io.socket.engineio.client.Socket.<init>(Socket.java:215)
	at io.socket.engineio.client.Socket.<init>(Socket.java:174)
	at io.socket.client.Manager$Engine.<init>(Manager.java:555)
	at io.socket.client.Manager$1.run(Manager.java:233)
	at io.socket.thread.EventThread.exec(EventThread.java:55)
	at io.socket.client.Manager.open(Manager.java:222)
	at io.socket.client.Manager.open(Manager.java:212)
	at io.socket.client.Socket$3.run(Socket.java:122)
	at io.socket.thread.EventThread$2.run(EventThread.java:80)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 30
	at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:238)
	at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
	at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
	... 16 more

As a workaround adding implementation 'com.squareup.okhttp3:okhttp:3.14.9' in gradle dependencies fixes the issue. But we should wait for an update in socket.io java package.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Android 11+ crash and inspect the stack trace through okhttp3.internal.platform.Platform and io.socket.engineio.client.Socket. Review the Gradle dependency declarations and compare the bundled OkHttp version with the reported 3.14.9 workaround; done means the socket no longer crashes on Android 11+.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.