Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Concurrency and Error Handling What To Do When the Network is Down

Ana K
Ana K
826 Points

Fatal exception, the app does not work

I did everything as teacher did in the video ("What To Do When the Network is Down"- weather app course). In the end I ran the app, in the log I saw that the weather data was received but suddenly the app crushed with FATAL EXCEPTION: OkHttp Dispatcher Process. What can it be? Here is the text from the log:

FATAL EXCEPTION: OkHttp Dispatcher Process: ws.tilda.anastasia.stormy, PID: 3157 java.lang.IllegalStateException: closed at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:377) at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:371) at okhttp3.internal.Util.bomAwareCharset(Util.java:397) at okhttp3.ResponseBody.string(ResponseBody.java:173) at ws.tilda.anastasia.stormy.MainActivity$1.onResponse(MainActivity.java:52) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)

1 Answer

Ana K
Ana K
826 Points

oh , my mistake! I forgot to delete Log.v(TAG, response.body().string()); from the block if response is successful. Now everything works fine!

Henrique Voni
Henrique Voni
12,296 Points

I had the same problem. Thanks for posting the solution.

AGHA ALI
AGHA ALI
Courses Plus Student 136 Points

thank You I was having the same issue...got rid of Log.v now its working in the debugger!