Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Debugger - missing platforms in "alternative source" popup

I'm debugging an app using Android Studio debugger. I stepped into some system classes and got the common "Source code does not match the bytecode" message. A "alternative source available for class..." bar also appeared. There's a spinner allowing me to select the sources to use with the debugger.

The only choice I have is between Android API 25 and 26 platforms, despite the fact that I have also downloaded and installed sources for other API levels. I'd like to preview the sources for API 22.

Android API 25 and 26 platforms are the only Android sources listed under the "External Libraries" section in the Project sidebar.

I'm running Android Studio 3.0.1.

like image 271
SpaceBison Avatar asked Feb 28 '18 07:02

SpaceBison


1 Answers

I managed to find a workaround for this problem. To get the desired Android sources to be available for preview in the debugger:

  1. Start a debug session normally
  2. While the debugger is running change compileSdkVersion in build.gradle to the chosen API level
  3. Start Gradle sync. The sync will probably fail and it's OK.
  4. The chosen API platform sources will appear in "External Libraries" and should be now available for preview in the debugger.
like image 158
SpaceBison Avatar answered Oct 22 '22 15:10

SpaceBison