8

I have a library project and another project which uses some classes from the library project. As soon as I am setting a break point in one of the library classes, and my app stops at the break point, Eclipse shows me the error message

Source not found

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

Can someone help me?

the error message

stoefln
  • 14,498
  • 18
  • 79
  • 138

4 Answers4

21

I found the answer!

Somehow (dont ask me why) Eclipse messed up my librarry projects classpath file. it listed the "src" classpath entries in the wrong order (see attachment below).

looks like only the first entry is currently exported to the libraryproject.jar, which is used by my app-project. Therefore only the gen-sources got attached, and not the sources in the src dir.

enter image description here

stoefln
  • 14,498
  • 18
  • 79
  • 138
  • 1
    Its also possible to change the order inside of the eclipse project property dialog. I guess I changed the order there by accident... – stoefln Mar 17 '14 at 14:19
  • Where can I find that document? – Sterling Diaz Apr 15 '14 at 23:37
  • its in the root of your project: .classpath (hidden file, so you have to look in the console or edit visibillity settings in your OS preferences) – stoefln Apr 16 '14 at 12:43
2

I finally found the real and most simple solution to this.

If you have a complex structure where one library project use a library, and that library project is used for your project, and so on. Or in any case... do this to solve this problem:

Import to eclipse the library you want to be able to see the source code for debugging proccess.

Mark the Is Library Option by Right Clicking the project > Propertie > Android

Then go to all the library projects that uses that library, and Right Click the project > Propertie > Android > Add > and select your library.

Then, go to your project and the library project that is in the Project>Properties>Android>Library_name, click remove and add it again, in order to be able to assume the changes in the library project.

And that's all. It's just use the project of the library itself instead of just using the jar of the library you want to see the source code.

For any question with helping you to implement this, just write to me.

Sterling Diaz
  • 3,789
  • 2
  • 31
  • 35
1

I had a similar issue with a gradle Java project but the message was this: "The jar of this class file belongs to container 'Gradle.Dependencies' which does not allow source modifications to source attachments on its entries"

In my case, the reason was because my project depended on other projects that generate jars and these wasn't updated. So, the solution was to do again all the clean build commands in every project and redeploy the project where I needed to run the debug.

jmoran
  • 164
  • 1
  • 5
  • Thanks! It worked. Clean and build all the projects involved will solve this issue. – aJaY Oct 26 '22 at 06:26
0

This has been an issue reported for ADT 17 and you can find a solution here

Snehal Poyrekar
  • 735
  • 5
  • 17
  • Thanks. I tried to put a library.jar.properties file next to the library.jar file which is generated in the bin folder of the library project. Its the same jar file which is referenced in my app-project. However, this didnt help at all. The content of the properties file is: src=../src/ – stoefln Sep 26 '13 at 15:53
  • Further R20 (which should fix that bug) was released last year. I have the most recent version of all SDK components, so I shouldnt have any troubles with library projects right? – stoefln Sep 26 '13 at 16:23