The Jar of this class file blongs to container Android 2.0.1 which does not allow modifications

前端 未结 2 1128
别跟我提以往
别跟我提以往 2021-01-13 15:48

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 Micr

2条回答
  •  孤城傲影
    2021-01-13 16:46

    Does this article "Making Eclipse show Android’s source" (from Malcolm Rowe) help? (for SDK1.5, adapt it 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.

    eclipse build path dialog

    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.

    Eclipse Android source

提交回复
热议问题