views:

1272

answers:

1

can any one provide me solution to this error i have searched alot to this problem but failed

i am using eclipse with ADT

with android sdk 2.0.1
OS Microsoft windows VIsta x86

+4  A: 

Does this article "Making Eclipse show Android’s source" (from Malcolm Rowe) help? (for SDK1.5, adpat for 2.0)

Once you have a source JAR, you’d normally expect to just attach it directly to the library in Eclipse, but that doesn’t work with the Android SDK: Eclipse says “The JAR of this class file belongs to container ‘Android 1.5’ which does not allow modifications to source attachments on its entries.”

Which is a roundabout way of saying that the source path is fixed. If you open up the Eclipse project properties dialog, change to the Java Build Path page and Libraries tab, then expand the ‘Android 1.5’ library container and then the android.jar file (phew!), you’ll see the ‘Source attachment’ option, which shows where the source is expected to be.

alt text

For the Android 1.5 SDK, this is SDK Location/platforms/android-1.5/sources (and presumably similarly for the Android 1.1 target), where SDK Location is the path set in the workspace preferences’ Android page. Note that the 1.0 SDK (which only supported the 1.0 target, of course) just appends the string sources to the SDK Location, on the assumption that the SDK location ended with a trailing slash. (This should only be something to look out for if you need to target 1.0; I’m pretty sure it was fixed in the plugin provided with the 1.1 SDK.)

There are two ways to put the source JAR into the right place.

  • The conventional way is to create a directory called sources/ under platforms/android-1.5/ (or 1.1), and then unzip the JAR (which is just a ZIP file) into that directory.
  • However, although sources doesn’t have an extension, Eclipse doesn’t actually require it to be a directory, so a simpler way is just to rename your source JAR so that it’s called sources, and move it into the relevant directory.

Once you’ve moved the file or files into the right places, you just need to get Eclipse to take note of it. I found that just restarting Eclipse was enough, but if that doesn’t work you could always try refreshing the project, or closing and re-opening the project via the context menus.

alt text

VonC
guide me little bit more you talked about this pathThe conventional way is to create a directory called sources/ under platforms/android-1.5/ (or 1.1), and then unzip the JAR (which is just a ZIP file) into that directory. in my case it isE:\Anroid\SDK\android-sdk_r04-windows\android-sdk-windows\platforms\android-2.0.1and adroid.jar file is already in itor what else i am missing??
UMMA
No, you need to generate your own source JAR based on the Android Open Source Project. Read the full article VonC linked you to.
Christopher
by doing this that error is gone now but another one is coming.. what you say about it??Source not foundEdit Source lookup path(written on button)
UMMA
@UMMA: that is when you should to edit the "source attachment" (as shown in the picture) to refer to the proper jar sources or directory sources.
VonC
dear friend i am new to java could you please guide me how to obtain proper jar file ??
UMMA
that tutorial saying in order to generate source code of yours you must have installed git i have installed it please guide what should i do next????
UMMA