I'm using React Native Track Player on a TV Box running android 7.1.2
And I'm getting a crash when trying to remove a song from the queue.
Here is the error:
FATAL EXCEPTION: main
Process: com.mytvapp, PID: 6889
java.lang.UnsupportedOperationException
at java.util.AbstractList.set(AbstractList.java:132)
at java.util.AbstractList$ListItr.set(AbstractList.java:426)
at java.util.Collections.sort(Collections.java:247)
at com.doublesymmetry.kotlinaudio.players.QueuedAudioPlayer.remove(QueuedAudioPlayer.kt:154)
at com.doublesymmetry.trackplayer.service.MusicService.remove(MusicService.kt:318)
at com.doublesymmetry.trackplayer.module.MusicModule$remove$1.invokeSuspend(MusicModule.kt:328)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:755)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@299f479, Dispatchers.Main]
Points to this code
fun remove(indexes: List<Int>) {
val sorted = indexes.toList()
// Sort the indexes in descending order so we can safely remove them one by one
// without having the next index possibly newly pointing to another item than intended:
Collections.sort(sorted, Collections.reverseOrder());
sorted.forEach {
remove(it)
}
}
Now based on some research I suspect either the function is unsupported in android 7 or another one is its trying to remove from a non-modifiable list.
I've opened an issue on https://github.com/doublesymmetry/react-native-track-player/issues/2187
I'm using React Native Track Player on a TV Box running android 7.1.2
And I'm getting a crash when trying to remove a song from the queue.
Here is the error:
Points to this code
Now based on some research I suspect either the function is unsupported in android 7 or another one is its trying to remove from a non-modifiable list.
Any ideas?