java - 此类文件的Jar blongs到不允许修改的容器Android 2.0.1

标签 java android eclipse

任何人都可以为我提供解决这个错误的方法吗我已经搜索了很多这个问题但都失败了

我正在使用 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”选项,它显示了源的预期位置。

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

关于java - 此类文件的Jar blongs到不允许修改的容器Android 2.0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2064100/

相关文章:

java - StringUtils - 替换同一行的不同单词

java - 将 ArrayList 转换为 LinkedList

java - 从设备联系人应用程序中打开并选择联系人

java - 在 Android 中解析多个段落标签中的文本

android - Android 中的 G729 编解码器支持

java - 是否有用于android的git库

java - 使用 Java 9 和 Java 10 从 Eclipse 上的 Tomcat 中删除 java.endorsed.dirs

java - 在 Java 中从 Mallet 导入类

java - maven依赖没有添加到eclipse中的jar中

java - 将android项目添加到git