最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Android的ADT调试期间出现提示:The Jar of this class file belongs to container ‘Android Dependencies’ which does not allow modifications to source attachments on its entries

Android crifan 5883浏览 0评论

【问题】

折腾:

【未解决】Eclipse的ADT中调试Android程序时给jar包添加源码以便源码级调试

期间,注意到:

当看不到Class File Editor中可以显示让自己选择源码的是,就有对应的:

The Jar of this class file belongs to container ‘Android Dependencies’ which does not allow modifications to source attachments on its entries

如图:

The JAR of this class file belong to container Android Dependencies which does not allow modifications to source attachments on its entries

所以要去搞清楚到底是什么意思。

【解决过程】

1.参考:

The Jar of this class file belongs to container ‘Android Dependencies’ which does not allow modifications to source attachments on its entries

去:

D:\DevRoot\xxxx\TFS_Root\Main\src\MobileHandHeld\libs>touch usb-serial-for-android-v0.2.1-pre.jar.properties

D:\DevRoot\xxxx\TFS_Root\Main\src\MobileHandHeld\libs>

想要接着加src和javadoc配置呢,

突然发现,此处我这里,根本就没有对应的source.jar的包。

所以没法直接加上述类似的配置。

2.后来自己去找到对应的dependencies的位置,结果却发现,source attachment,根本无法手动加源码:

libraries android dependencies usb serial jar source attachment none modifiable

所以,还是不行。

3.参考:

The jar of this class file belongs to container ‘Android Dependencies’ which does not allow source modifications to source attachments on its entries

去确认了自己的ADT版本,是21,不是17:

current adt version is 21 not 17

4.参考:

无法查看第三方jar包源码解决

结果右击对应的

usb-serial-for-android-v0.2.1-pre.jar

根本找不到什么Build Path:

right click usb serial jar not build path

包括对应的Property中,也没有什么Build Path:

usb serial lib properties not build path

5.这里:

Android ADT 18+ 添加第三方源码包挂载以及查看问题解决

也是说:

不要把jar放在libs,而放在lib中,就可以去通过Build Path添加源码了。

但是:

我此处,不希望去改动目录结构,必须还是把jar要放在libs中。

6.参考:

eclipse 遭遇及解决 debug调试时 因Android Dependencies而Source not found

去Debug视图下,右击线程,选择:

Edit Source Lookup

debug mode right click thread edit source lookup

然后去添加:

Default->Add->Java Project

edit the source lookup path default add java project ok

choose related source code project then ok

added usb serial project then ok

然后需要注意的是:

当前Class File Editor界面中,并不会变化,还是不能同步看到源码。

但是:

继续调试,或者说,重新调试,再去单步F5执行的话,就可以看到源码了:

then redo debug f5 can into source code for usb serial prober

如此,真正的,解决了此问题。

 

【总结】

此处,ADT中调试出现:

 

的问题:

解决方法:

1.不推荐的:

项目中,新建lib文件夹,把对应的jar,从默认加入到的libs文件夹中,移到这个lib文件夹

然后右击对应的jar,然后通过Build Path,去添加对应的源码。

2.推荐的:

在调试期间,即Debug视图下,

右击那个Debug的Tab中的当前的Thread

Edit Source Lookup->Default->Add->Java Project->选择你的jar所对应的源码所在的项目->OK->OK

再继续debug或者是重新debug,即可实现:F5可以进入对应的源码,进行源码调试了。

提示:

个人猜测:

即使你没有源码所对应的项目,估计通过添加对应的文件夹(Absolute File Path或File System Directory之类的),应该也是可以添加源码的。

转载请注明:在路上 » 【已解决】Android的ADT调试期间出现提示:The Jar of this class file belongs to container ‘Android Dependencies’ which does not allow modifications to source attachments on its entries

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. .classpath內文調整 大致上順序調成這樣
    咬你歐10年前 (2014-06-06)回复
86 queries in 0.172 seconds, using 22.15MB memory