JcPlayer icon indicating copy to clipboard operation
JcPlayer copied to clipboard

java.lang.StackOverflowError: stack size 8MB

Open rohankandwal opened this issue 6 years ago • 4 comments

Getting stackoverflow error some times, not sure about the scenario when it is occuring

java.lang.StackOverflowError: stack size 8MB
        at com.example.jean.jcplayer.service.notification.JcNotificationPlayer$Companion.getInstance(Unknown Source:2)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:186)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)
        at com.example.jean.jcplayer.JcPlayerManager.createNewNotification(JcPlayerManager.kt:192)

rohankandwal avatar Feb 13 '19 08:02 rohankandwal

hey bro, Did you solve this error..??

MustafaAndroid avatar Mar 02 '19 06:03 MustafaAndroid

@MustafaAndroid I added a try catch

try {
                      createNewNotification(iconResource)
                    } catch (e: Exception) {
                      e.printStackTrace()
                    }

rohankandwal avatar Mar 13 '19 12:03 rohankandwal

Same here, the problem occurs when you call createNewNotification, close app without removing it from the recents list, then launch and call createNewNotification again.

Only hack I've found so far is to keep a boolean in a static class to check whether you should call createNewNotification again or not.

melihakalan avatar Apr 27 '19 11:04 melihakalan

@melihakalan Not necessarily needed, if you use same notification ID, the old notification will be automatically removed.

rohankandwal avatar May 16 '19 06:05 rohankandwal