The JAR of this class file belongs to container 'Android Private Libraries' Android查看外部依赖jar的源码问题解
来源:互联网 发布:淘宝开店货铺太多好吗 编辑:程序博客网 时间:2024/06/01 08:12
在Eclipse中开发android的应用程序时,有时想查看函数的内部实现,但是当在函数上点击ctrl和鼠标左键的时候,
往往出现如下提示:
Class File Editor
Source not found
The JAR of this class file belongs to container 'Android'? which does not allow modifications to source attachments on its entries.
最普遍常见的是android-support-v4没法看到其中的注释和源代码,鼠标放到类上提示:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
解决步骤:
一般来说如果环境配置好了,Android的所有类和所有方法都能看到其代码和注释,以下分两步,将注释和代码全部配置正确。
1.Android本身jar包的源代码
这里假设已经把需要下载的都下载下来了,右键项目====》build path====》configure build path
在libraries里选择Android x.x.x里面有Android.jar,这就是开发时所依赖的Android本身的sdk的jar包,点开,里面有两个需要配置,
source attachment和javadoc location,前者是源代码,配置好后可实现ctrl+鼠标左键直接点开想看的Android的类,
后者是源代码的注释文件,配置好后可实现鼠标放在想看到类上,会显示出来这个类或者方法的介绍
选择source attachment配置项,点击右边edit,选择external location===》external folder,然后找到正确的路径,我的是在E:/eclipse/sdk/sources/android-19
选择javadoc location配置项,edit,选择javadoc url===》browse,然后找到正确路径,我的是在file:/E:/eclipse/sdk/docs/reference
完成上面这些就可以正常查看Android内部常用的类注释和源代码了
2.查看外部依赖jar包的源代码
这里假设你已经把外部依赖的jar包正确导入并且编译通过了,但是ctrl+鼠标左键想看代码或者想看其注释却不可行的情况,
首先在libs下面找到引入的包,这里以android-support-v4.jar为例,
在libs下新建android-support-v4.jar.properties文件,即与引用的jar包同名最后加上.properties的文件
其内容如下:
src = E:\\eclipse\\sdk\\extras\\android\\support\\v4\\src
这里路径要根据你自己的路径进行调整,配置之后退出eclipse,在进入,就可以正常查看了。
拓展:
Eclipse查看源码
eclipse中有这样一个功能,就是在编写程序的时候,按住 Ctrl 键不松手,这时用 鼠标去点击某个方法或者类,就会看到该方法或类的源代码。
不可用,问题解决
Eclipse设置,在 JAVA / Build Path / Classpath Variables 下有一个 JAR_SRC 变量,该变量负责设置源代码路径,但是该变量是不可修改的,必须由系统自动检测。
原来是另外一处没有设置好,在JAVA / Installed JREs 中,可以选择一个 JRE 来支持 Eclipse ,而一般情况下我们的机器中都装了 2 套 JRE ,一套有源码,一套无源码,而系统恰恰选择了那套无源码 的 JRE ,因此在使用中便无法查看源代码。
问题找到后,解决起来就方便了。点击最右边的Search 按钮,选择 Search 的路径为你安装 JDK 的路径, 在我的机器上是 C:"Program Files"Java"jdk1.5.0_08 ,经过查找后,系统就会发现另外一套 JRE ,这套 JRE 是有源代码的,这时你选择刚刚找到的这个 JRE 作为? Eclipse 的默认 JRE ,那么就可以正常查看源代码了!
来源路径:http://www.chengxuyuans.com/Android/92821.html
- The JAR of this class file belongs to container 'Android Private Libraries' Android查看外部依赖jar的源码问题解
- eclipse 第三方jar包 关联源码,提示 The Jar of this class file belongs to container 'Android Dependencies'
- eclipse 第三方jar包 关联源码,提示 The Jar of this class file belongs to container 'Android Dependencies'
- The Jar of this class file belongs to container 'Android Dependencies' which does not allow modifica
- 【已解决】Android的ADT调试期间出现提示:The Jar of this class file belongs to container ‘Android Dependencies’ whic
- Android之查看外部依赖jar的源码_android private libralies does not allow modifications to source
- Android之查看外部依赖jar的源码_android private libralies does not allow modifications to source
- 点击查看外部依赖jar的源码报找不到 android private libralies does not allow modifications to source
- 我的Android进阶之旅------>Android无第三方Jar包的源代报错:The current class path entry belongs to container ...的解决方法
- Android 无法查看外部依赖jar的源码的问题
- Android 无法查看外部依赖jar的源码的问题
- Android 无法查看外部依赖jar的源码的问题
- Android 无法查看外部依赖jar的源码的问题
- Android之查看外部依赖jar的源码
- Android查看外部依赖jar的源码,如android-support-v4.jar
- android private libraries中的jar添加源码文件过程
- Android+eclipse查看jar在private libs源码设置
- Android private Libraries 下查看源码问题
- android EditText中的inputType
- linux 静态库的链接 undefined reference
- 关于控件drawbleTop属性里面照片大小的控制
- android 对象的序列号与反序列
- 设计模式中的六大基本原则
- The JAR of this class file belongs to container 'Android Private Libraries' Android查看外部依赖jar的源码问题解
- NIO框架(3)---Selector
- 02.设置动态库路径(LD_LIBRARY_PATH 变量)
- 第14章 文件系统
- 运用service、BroadcastReceiver保持app不被系统杀死
- imageloader的简单使用
- 算法03 之链表
- json11库的使用
- 扫码登录操作过程