Open
Description
Describe the bug
Socket is being connected at the same time app is getting crashed at (even try block is not able to catch it)
To Reproduce
2022-09-29 20:14:37.069 24427-24464/com.arriyam.countersocketandroid E/EventThread: Task threw exception
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.arriyam.countersocketandroid.MainActivity.onCreate$lambda-0(MainActivity.kt:17)
code is in kotlin android
fun setSocket() {
try {
mSocket = IO.socket("http://10.0.2.2:3000")
} catch (e: URISyntaxException) {
Log.e("TAG", "URISyntaxException")
}
}
Expected behavior
Platform:
- Device: [e.g. Samsung S8] Android Studio latest
- OS: [e.g. Android 9.2] Android 11 api 30+
Additional context
Add any other context about the problem here.