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) Working with JSON Setting CurrentWeather from JSON

Chenaj Teja Potu
Chenaj Teja Potu
2,972 Points

Error in Debugging

I am getting this error

Connected to the target VM, address: 'localhost:8606', transport: 'socket'

2 Answers

I had the same error without anything more happening, but then I noticed that I had Airplane Mode activated in the emulator. Turning it off solved the problem.

That is not an error message, actually. That is a sign that debugger is working all fine.

But if your debugger buttons (step over, step into, step out, etc) are disabled, then it means that your code doesn't execute the line at the breakpoint (at line 86 or whatever) you set. Take a look at the code below:

String jsonData = response.body().string();
Log.v(TAG, jsonData);
if (response.isSuccessful()) {
    mCurrentWeather = getCurrentDetails(jsonData);
} else {
    alertUserAboutError();
}

As you can see, if the response is not successful, then getCurrentDetails() is not going to be executed and that means you won't reach the breakpoint you set (because it is inside the getCurrentDetails() method). That means if you have problem with internet connection (possible reasons: airplane mode is on, mobile data is off, etc), you won't be able to reach the breakpoint.

[too long, didn't read] If your debugger buttons are disabled

  • Make sure you have internet connection.
  • Make sure your android system is not on airplane mode.
  • Make sure your android system's mobile data is on.