Fix a crash issue on Android "Fatal Exception: java.lang.IllegalStateException"#353
Fix a crash issue on Android "Fatal Exception: java.lang.IllegalStateException"#353thanakij wants to merge 3 commits into
Conversation
…Exception. This YouTubePlayer has been released (YouTubePlayerController.java:315)'
…Can not perform this action after onSaveInstanceState (YouTubeView.java:50)'
|
Did this work for you? I was reviewing your code. I was heading down the same lines. Just wondering if it's working? @thanakij |
There are no Crashlytics report of the same errors so far. However, I have found one new issue, "No view found for id 0x36e7 (unknown) for fragment VideoFragment{664a5dc #0 id=0x36e7}. (OS: FragmentManager.java:1004)". This StackOverflow discussion reveals that it may relate to my changes. The error is likely from fragmentManager.beginTransaction().add(getId(), mVideoFragment) and for some reason such view cannot be found. |
|
@thanakij does your fix prevent the new issue? |
|
No, like discussed earlier, the fix incurs new issue. I believe this is because the real root cause is not resolved yet. Eventually, we simply get a different error message when crashing (but it is sure less often). Let's look at #336. It also tried to tackle the same original issue. |
|
For anybody who visits this, I have decided to drop this react-native-youtube dependency from my project as this lib is pretty much dead and unmaintained. Next, I have replaced it with WebView for now. It works well so far. In addition, you may have to use react-native-android-fullscreen-webview-video to enable "fullscreen" mode for Android. |
|
@davidohayon669 #357 is also using commitAllowingStateLoss(), but like what I experienced with my own pull request, it probably would result in another issue, "No view found". For commit(), if there is a state error, it will throw an exception. However, by using commitAllowingStateLoss(), if there is a state error, the error is still there but Android will not throw an exception and we wouldn't know. In short, it was meant for a quick fix and many suggested to use this method only for a last resort. I don't know what is the real root cause for this IllegalStateException but something like #336 looks interesting to me because it added mPlayerAvailable for safety.. |
Hi,
Our team have experience a crash issue reported by Crashlytics saying "Fatal Exception. This YouTubePlayer has been released (YouTubePlayerController.java:315)"
We are using latest commit #1c2d9dc (at the time of writing) for our package.json.
I have tried to strengthen the code with the "try ... catch" block and
would like to submit a pull request for review.
Thanks!