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 th
I added appengine sdk and some other sources, and that destroyed my ADT :-(
I saw that for android-16 and android-17, the platform libraries downloaded by SDK Manager started going to ./sdk/sources whereas prior to my adding appenginge sdk, SDK Manager sent platforms to ./sdk/platforms.
It looks like the change is as a result of the appengine sdk, but for ADT, platform APIs should def be going to ./sdk/platforms
The path ./sdk/sources seems like a more generic java location and is probably the 'correct' path. Thus Android, as usual, is the problem. I was pretty sure from this point forward, I would need both ./sdk/sources and ./sdk/platforms, depending on what I was compiling.
So, I moved everything from ./sdk/sources to ./sdk/platform, deleted ./sdk/sources and then created a link 'cd sdk && ln -s platform sources'
Everything works now ;-)
For me the only solution which worked was the answer of fsbmain. Kudos to him. I can't comment on his solution because of my low reputation counter. But I want to share my knowledge ;)
I'm working on windows and don't wanted to copy the whole source tree to another location. And copy again on updates etc. So I used the possibility to insert a symbolic link which works since Windows Vista like a charm (or like Linux). For Linux you have to look at the Joe's comment under fsbmain's answer.
Assuming you have the platform in D:\sdk\platforms\android-19. Now you have to make a subdirectory sources and after that create a relative link to the real sources folder.
D:\sdk\platforms\android-19>mkdir sources
D:\sdk\platforms\android-19>cd sources
D:\sdk\platforms\android-19\sources>mklink /D android-19 ..\..\..\sources\android-19
Now restart Eclipse ... Done!
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
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!
To attach source code for android.jar, you may follow the tutorial at the link below: http://android.opensourceror.org/2010/01/18/android-source/ Make sure to choose the correct platform version.
If you meet difficutly with spinner, try to get the sample code and see how it works: http://developer.android.com/resources/samples/get.html
Good luck. :)
This answer is quite out of date, please consider other answers.
If adding folder android-sdks/sources/android-17
as external source doesn't work (as in my case) you can try to create folder android-sdks/platforms/android-17/sources/android-17
copy sources to it and restart eclipse (I have eclipse Juno Service Release 1). Only this way works for me.
Steps to do this for android-17:
adroid-sdk
install folder, for me it's d:\ws\android-sdks\
android-17
sources folder from android-sdks\sources\android-17\
to the android-sdks\platforms\android-17\sources\
(your have to create folder sources
here manually) folder so the final path to the sources must be the: android-sdks\platforms\android-17\sources\android-17\
UPD: the same solution with symlinks
:
Windows Vista+ (thanks @saleemrashid1 for mentioning mklink
in comments):
1. cd platforms\android-17
2. mklink /D "sources\android-17" "..\..\..\sources\android-17"
For Unix-base OSes (@Joe comment):
it works fine to create the directory and symlink "sources/android-XX" to "../../../sources/android-XX":
mkdir platforms/android-19/sources &&
ln -s ../../../sources/android-19 platforms/android-19/sources/android-19.