Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio debugger stepping though old version of code, not up to date

I'm new to Android dev so I may be missing something obvious that I can try.

I'm trying to debug some code but the debugger is stepping through the old version of the code, and not current version in my project.

wrong debug lineClearly it has skipped past my exception 'throw' and into commented code

I have tried:

  • Uninstalling the previous apk installed to the device
  • Rebuild/clean
  • Using Genymotion and a real device (Gingerbread)
  • adb kill-server
  • Restart And. Studio
  • Similar questions on SO

This is actually the cwac demo v9, so it's a demo app that uses the 'camera' library, and it is in the cwac camera library project that I am debugging.

What's unclear to me is where and what is built by gradle, so I haven't 'hard cleaned' anything from Windows explorer. I can't even check file dates...

What tips can you give me please for how to check that the latest code is going out to the device?

Thanks.

like image 953
Jim W says reinstate Monica Avatar asked Nov 01 '22 07:11

Jim W says reinstate Monica


1 Answers

Try this. Open up your app's build.gradle file, and make a change (just add white space). Then, click the "Sync Now" button in the top right corner.

I am not too sure what is going on with caching, but this seemed to fix it for me.

like image 93
Dave Avatar answered Nov 11 '22 12:11

Dave