This is a cool trick that will allow you to view the source of your android-support library (Compatibility package).
Here’s what you need to do
Make sure you have the correct version of ADT.
You need to be on ADT 20 or later. Go here to get the latest ADT installed.
Add the support library to your project
After adding your Support Library, (project properties > android tools > add compatibility package.
Create a .properties file for your jar and set the path to the support source. It is in your SDK
Now go to your project’s libs folder and create a file that is the same name as your android-support-v4.jar file and add .properties at the end.
Something like this:
Your path will be in your <SDK_PATH>/extras/android/support/v4/src
Now close your project and open it back up.
You should now be able to open up the source code for your library. To confirm, go under Android Dependencies, find the android-support-v4.jar
Expand down to the classes inside the package, clicking one should open up the source in your editor.
This neat feature works for any Jar library you have the source to. Enjoy! thanks to Simon for showing me this cool feature.
You can set a source attachment for your android-support or any other JAR that doesn’t allow source attachments by adding a properties file. It’s easy and works for any jar you have the source to.
And it only takes a few easy steps:
- Make sure you have the correct version of ADT.
- Create a .properties file for your jar and set the src=/path/to/your/source inside it.
- Close and re-open your project