Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to attach source to android.jar

I am new to Android. I am working in the Windows OS with the Eclipse IDE. My simple application has a spinner that populates a list from database column. When I click on the spinner Class, the file Editor says that source not found and the android.jar has no source attachment.

I downloaded the source code and placed it in this location:

android-sdk-windows\platforms\android-8

Then, I attached this source by these steps:

right click the project => build path=> configure build path=> libraries => source attachment => give the path of the source code downloaded.

But, I didn't get any solution for my debug. Again, when clicking on the spinner it opens the debug that android.jar has no source attachment.

like image 406
Santhosh_pulliman Avatar asked Apr 22 '11 06:04

Santhosh_pulliman


2 Answers

This is now really easy!

Go to Window->Android SDK Manager and install "Sources for Android SDK".

Now try to control-click some Android identify, you will get the usual "no source attached" page. Click "Attach Source" and get the option to select an external folder.

Now browse to /home/me/android-sdks/sources/android-16 (or wherever your SDK is installed; this is the default), and hit ok.

It should think for a moment and then display the source! Yeay!

like image 161
Timmmm Avatar answered Oct 05 '22 21:10

Timmmm


Unless you need older API sources, you are probably better served by Timmmm's answer. If you do need sources older than 14, read on...

In Eclipse simply go to

Help -> Install New Software

then add update site

http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/

and go through the motions to install it.

This will happily provide sources for all installed API versions and works very well for me. Some more documentation is here

http://code.google.com/p/adt-addons/

look for the heading Android Sources

like image 32
thomanski Avatar answered Oct 05 '22 19:10

thomanski