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 trialMarcel Schmidt
12,134 PointsEmulator doesn't care for changes in code
So I'm using genymotion emulator, and this is the first time I'm having this issue.
I've been playing around a lot with verbose debug logs in the Callback().onResponse method to see if I'm actually getting there, because I'm not getting the same data output as ben, while the app doesn't crash either.
Which was hard to do, because fo the most part, my genymotion emulator doesn't care for changes I make in my code. What that means is, I change the way I'm logging in the code, run the new code, but the app in the emulator still logs the same stuff as before (despite having deleted those logs). Actually uninstalling the app from the emulator instance before running it again doesn't help. Sometimes, when adding yet new logs (or any new code), genymotion will update to the state my app was in before the most recent changes.
When I close the genymotion instance and open up a new one, I get the update on the app, but I surely don't want to have to close/open a new emlator instance everytime I want to look at a change I made in my code.
Also, I started using VCS wth github with this weather app project, just for practice. committing the changes seems to solve the issue to, but it's not really a solution because, again, you do not want to commit every small change you make!
This is quite frustrating because this kind of behaviour is just pure nonsensical. Why wouldn't the emulator show me the updated up, instead of using code I have already deleted?
2 Answers
Ivan Sued
5,969 PointsHmm I am not sure why it is not working. I am using Genymotion and it works fine. Do you have the Genymotion plugin installed? I usually start Genymotion like you do and when I make changes and want to run them on the emulator I just hit the play button to run the application and select the running emulator if it is the first time of the day and check it as "run this every time" at the bottom of the modal page for selecting the emulator. I do not restart anything.
Wesley Seago
10,424 PointsIf you clear the logs in Android Studio, the information is not deleted...it only clears the screen for you to get a fresh view. When you start Android Studio, the logs are fresh. Also, pushing to git should clear it out if you have not changed your preferences.
In the case of the original context of your question, when looking to see if you are hitting a method, you should be attaching a debugger with a break-point set to where you want to check. Using the logs is possible (you can add a toast, or an Alert Dialog, or just a log statement which is what it sounds like you are doing) but with the debugger you will be able to follow your code step by step while monitoring values of variables and arrays, etc.
The debugging tools in Android Studio / Eclipse are a little more challenging to learn than others (such as XCode) but they are very powerful if you take the time to learn them.
If you need help with the debugger:
https://developer.android.com/tools/debugging/debugging-studio.html
Marcel Schmidt
12,134 PointsThank you very much wesley! This information clears up the situation quite a lot for me.
Marcel Schmidt
12,134 PointsMarcel Schmidt
12,134 PointsYeah it was working just fine like that until I got into the weather app project. This is the first time I also actively make use of version control, so maybe I screwed that up somewhere...
I was just about to do it all from scratch again without version control, seeing as my other applications still run just fine with genymotion. I will update this when I get some more insight on this.
Ivan Sued
5,969 PointsIvan Sued
5,969 PointsYeah I was using vcs and it worked fine. But yeah let us know maybe something went wrong.