任何人都可以为我提供解决这个错误的方法吗我已经搜索了很多这个问题但都失败了
我正在使用 ADT 的 eclipse
使用 android sdk 2.0.1
操作系统 Microsoft Windows VIsta x86
最佳答案
这是article "Making Eclipse show Android’s source" (from Malcolm Rowe) help吗? ? (SDK1.5适配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.”
这是说源路径是固定的迂回方式。
如果打开 Eclipse 项目属性对话框,切换到Java Build Path
页面和Libraries
选项卡,然后展开“Android 1.5
”库容器,然后是android.jar
文件(呸!),您会看到“Source attachment
”选项,它显示了源的预期位置。
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/
(or1.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.
关于java - 此类文件的Jar blongs到不允许修改的容器Android 2.0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2064100/