How to debug the Android SDK source code in Android Studio.
When you develop an Android application with Android Studio, sometimes you may find strange errors. To solve this problem,
the best way is to debug and access the Android SDK source code to see how the code is implemented in detail.
This Android article will teach you how to do it.
the best way is to debug and access the Android SDK source code to see how the code is implemented in detail.
This Android article will teach you how to do it.
1. Get the target SDK version of the project in the build.gradle file.
You must first make sure that your compileSdkVersion and targetSdkVersion that is saved in the build.gradle file match your
a version of the SDK source code.
a version of the SDK source code.
In the left panel of the Android project, click Project Name -> application -> build.gradle. In the right panel,
you can see compileSdkVersion and targetSdkVersion.
you can see compileSdkVersion and targetSdkVersion.
2. Get the currently installed folder of the Android SDK version.
Click File -> Other Settings -> Default Project Structure in Android Studio. You can get the Android SDK location folder
Open the sources folder in the previous folder in the file explorer, you can see a list of the current Android SDK source code folders.
If the version of the Android SDK source code is not equal to the compileSdkVersion and targetSdkVersion value in the build.gradle file,
change the compileSdkVersion and targetSdkVersion value in the build.gradle file.
change the compileSdkVersion and targetSdkVersion value in the build.gradle file.
After changing the value of the SDK version, Android Studio will ask you to install the compilation tools related to the version as shown below.
After downloading and installing it, you will discover that you can debug and access the Android SDK source code successfully.
After downloading and installing it, you will discover that you can debug and access the Android SDK source code successfully.
3. Install the source code of the new version of the Android SDK.
You can also install the source code of the new version of the SDK if you cannot debug the source code of Android SDK.
Click on the Android class lib method in your source code and then direct it to the following code.
Because the version of the SDK source code installed does not match the SDK version of compilation and destination.
Then, Android Studio will display messages as below.
Because the version of the SDK source code installed does not match the SDK version of compilation and destination.
Then, Android Studio will display messages as below.
Click the Download link in the upper right corner of the prompt message. It will show you a dialog box that will
download the related SDK source code.
download the related SDK source code.
When the download process is finished, click on Finish button, you can find the source code folder of the new SDK
version in the “% ANDROID_HOME% \ sources” folder (C: \ Users\Rana\AppData\Local\Android\sdk\sources).
version in the “% ANDROID_HOME% \ sources” folder (C: \ Users\Rana\AppData\Local\Android\sdk\sources).
Restart Android Studio, then you can debug the Android SDK source code now.
4. Edit the Android SDK source code folder manually.
If you want to change the SDK source folder manually, you can follow the steps below.
- Open the Android Studio configuration options folder as shown below. C: \ Users\Rana\ .AndroidStudio2.3 \ config \ options
- Open the jdk.table.xml file in the options folder.
- You can change the value of the sourcePath element you want for each Android SDK element.
Comments
Post a Comment