Android studio shows sources from API of compileSdkVersion when debugging on device with older API

Answered with working solution here:

https://stackoverflow.com/a/32236703/1267536

Full content:

I use appcompat support library quite a lot. Changing the compileSdkVersion only results in massive compile errors. If you are using appcompat-21, you must compile against api 21 or you will get compile errors.

This works fine if you are debugging against version 21. But when you are debugging on Jelly Bean (API 17), your debugger keeps dropping you to the API 21 source. Very annoying and hard to debug.

The solution I’ve ended up using is very hacky but works! Let’s say you are trying to debug against API 17. Do the following:

  1. mv $ANDROID_HOME/sources/android-21 $ANDROID_HOME/sources/android-21-orig
  2. cp $ANDROID_HOME/sources/android-17 $ANDROID_HOME/sources/android-21
  3. restart android studio so it will pick up the correct paths.
  4. Debug

Just don’t forget to put all the directories back after you’re done.

Here’s an android studio bug report about this issue:
https://code.google.com/p/android/issues/detail?id=183976

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)