Android React Native 卡在启动画面
Android React Native stuck at splashscreen
有时,在后台运行很长时间后,我的应用程序无法加载并卡在启动画面上。
我能够通过以下方式在调试模式下重现此内容:
- 启动应用程序
- 远程使用调试 js
- 终止应用程序
- 启动应用程序
并且在发布模式下:
- 启动应用程序
- 进入参数
- 开发选项
- 启用不保留活动
- 再次启动应用程序
如果我在调试模式下尝试使用发布方法重现此错误,我会收到以下错误:
Process: com.situaction, PID: 22308
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.IllegalStateException: closed
at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:164)
at com.facebook.react.packagerconnection.ReconnectingWebSocket.closeWebSocketQuietly(ReconnectingWebSocket.java:110)
at com.facebook.react.packagerconnection.ReconnectingWebSocket.closeQuietly(ReconnectingWebSocket.java:103)
at com.facebook.react.packagerconnection.JSPackagerClient.close(JSPackagerClient.java:96)
at com.facebook.react.devsupport.DevServerHelper.doInBackground(DevServerHelper.java:158)
at com.facebook.react.devsupport.DevServerHelper.doInBackground(DevServerHelper.java:154)
at android.os.AsyncTask.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
好像跟react-native-navigation有关系and/or react-native-redux
所以这是我的依赖项:
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-native-navigation": "1.1.398",
"react-redux": "^5.0.5",
"redux": "^3.7.0",
"redux-logger": "^3.0.1",
"redux-observable": "^0.14.1",
"redux-persist": "^4.8.1",
"redux-persist-transform-filter": "0.0.13",
好的,如果发现这是一个 react-native-navigation 问题。
我通过降级到 1.1.250 版本解决了我的问题。
这似乎解决了问题,因为我无法再重现它,而且我的应用程序现在运行良好。
有时,在后台运行很长时间后,我的应用程序无法加载并卡在启动画面上。
我能够通过以下方式在调试模式下重现此内容:
- 启动应用程序
- 远程使用调试 js
- 终止应用程序
- 启动应用程序
并且在发布模式下:
- 启动应用程序
- 进入参数
- 开发选项
- 启用不保留活动
- 再次启动应用程序
如果我在调试模式下尝试使用发布方法重现此错误,我会收到以下错误:
Process: com.situaction, PID: 22308
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.IllegalStateException: closed
at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:164)
at com.facebook.react.packagerconnection.ReconnectingWebSocket.closeWebSocketQuietly(ReconnectingWebSocket.java:110)
at com.facebook.react.packagerconnection.ReconnectingWebSocket.closeQuietly(ReconnectingWebSocket.java:103)
at com.facebook.react.packagerconnection.JSPackagerClient.close(JSPackagerClient.java:96)
at com.facebook.react.devsupport.DevServerHelper.doInBackground(DevServerHelper.java:158)
at com.facebook.react.devsupport.DevServerHelper.doInBackground(DevServerHelper.java:154)
at android.os.AsyncTask.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
好像跟react-native-navigation有关系and/or react-native-redux 所以这是我的依赖项:
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-native-navigation": "1.1.398",
"react-redux": "^5.0.5",
"redux": "^3.7.0",
"redux-logger": "^3.0.1",
"redux-observable": "^0.14.1",
"redux-persist": "^4.8.1",
"redux-persist-transform-filter": "0.0.13",
好的,如果发现这是一个 react-native-navigation 问题。
我通过降级到 1.1.250 版本解决了我的问题。
这似乎解决了问题,因为我无法再重现它,而且我的应用程序现在运行良好。