Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch between android source version in Android Studio?

Currently it's not very intuitive how to switch between Android SDK source files in Android Studio while, for example, debugging or just inspecting the sources.

I've got the feeling that Android Studio, unlike IntelliJ, is getting the source's version from the compiled SDK version section of the Gradle configuration. But, this is forcing me to debug on a device which is using the same Android version when debugging. If I don't, then the sources won't be in sync with the debugger.

My question: Is there an easy way to switch between Android sources in Android Studio without having to change the configuration in build.gradle?

like image 382
Luca Vitucci Avatar asked Dec 03 '15 08:12

Luca Vitucci


People also ask

Can we change API level in Android Studio?

Step 1: Open your project in Android mode then go to Gradle Scripts > build. gradle(Module: app) as shown in the following image. Step 2: Refer to the below image and here you have to change the minSdkVersion and targetSdkVersion as per the requirement.


2 Answers

Try this:

  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

NodeJS program to easily switch the Android SDK Sources which Android Studio attaches when debugging.

like image 136
stefan Avatar answered Oct 11 '22 14:10

stefan


Try this:

  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

NodeJS program to easily switch the Android SDK Sources which Android Studio attaches when debugging.

like image 5
youpilat13 Avatar answered Oct 16 '22 16:10

youpilat13