简体   繁体   中英

React native android app Fatal exception on start and I cant trace the problem

React Native Android application, compiles fine, installs the APK but on running the application has a Fatal Exception straight away and I cannot trace the problem, I have a logcat view of the error but dont know how to solve it.

I have tried to debug but it closes straight away so I dont have a chance to do that. I have also tried searching for the specific error but have not managed to find something that fits.

07-06 20:09:56.697 27444 27479 E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
07-06 20:09:56.697 27444 27479 E AndroidRuntime: Process: com.t2capp, PID: 27444
07-06 20:09:56.697 27444 27479 E AndroidRuntime: java.lang.IllegalStateException: closed
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:398)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:392)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.internal.Util.bomAwareCharset(Util.java:412)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.ResponseBody.string(ResponseBody.java:173)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at com.facebook.react.devsupport.DevServerHelper$8.onResponse(DevServerHelper.java:485)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:784)
07-06 20:09:56.701  1170  6229 W ActivityManager:   Force finishing activity com.t2capp/.MainActivity
07-06 20:09:56.701 27444 27476 W unknown:ReconnectingWebSocket: Couldn't connect to "ws://localhost:8081/message?device=LLD-L31%20-%208.0.0%20-%20API%2026&app=com.t2capp&clientid=DevSupportManagerImpl", will silently retry
07-06 20:09:56.771  1170  1300 W InputDispatcher: channel '4439e16 com.t2capp/com.t2capp.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
07-06 20:09:56.771  1170  1300 E InputDispatcher: channel '4439e16 com.t2capp/com.t2capp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

The app used to work and I have come back to it recently to continue and encountered this, really stuck on whats wrong. I thought it was initially firebase issue but that doesnt seem to be the case as that connects (I used the firebase test by creating new app package and starting it up)

Your log is saying unknown:ReconnectingWebSocket: Couldn't connect to "ws://localhost:8081/ ...

It seems like you have hardcoded the Firebase socket url for your development environment (on your own machine, localhost).

You have to configure firebase for production.

Very basically it can be done like this :

language: javascript

if (process.env.NODE_ENV === 'development') {
    // define here your connection for development
} else {
    // define here your connection for production
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM