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

前端 未结 5 1453
慢半拍i
慢半拍i 2020-12-13 12:46

I am debugging with Android Studio (A.S) 1.0.2 with compileSdkVersion 21 set up in build.gradle. When using an emulator with API 21 everything works fine. The problem occurs

5条回答
  •  青春惊慌失措
    2020-12-13 13:21

    Change temporary the folder name of source files in the SDK. For example you compiled against API level 23 but the device you're testing and debugging is API level 15. Then first compile and run it in debug mode, set a breakpoint. After that switch the names :

    $SDK_HOME$/sources/android-23/ -> $SDK_HOME$/sources/android-23-temp/
    $SDK_HOME$/sources/android-15/ -> $SDK_HOME$/sources/android-23/
    

    And when this is done then it is a good time to hit your breakpoint.

    This solution is assuming that you've installed both API level sources from SDK manager.

提交回复
热议问题