第三方jar包无法查看源码

来源:互联网 发布:电脑抢票软件 编辑:程序博客网 时间:2024/05/23 22:54

From:ADT 17?

查看源码错误提示:
The JAR of this class file belongs to container 'AndroidDependencies'whichdoes not allow modifications to source attachments on itsentries.

Step by step guide

In order to link the sourcesand javadoc to a .jar library that isautomatically linked by Eclipse you have to do the following:

  1. Place the library .jar file in the libs folder,and the associated source .jar and doc .jar files in separatesubfolders such as libs/src and libs/docs.You can use a name other than src and docs ifyou want, but it's important that the .jar files aren't directly inthe libs folder.
  2. Create a .properties filein the libs folderwith the exact name of the actual library .jar (see example). Makesure you keep the .jar part.
  3. Specify the relative paths to the sources and javadoc .jar inthe .properties file.
  4. Close and re-open the Eclipse project!Optionally, refresh the project bypressing F5.
  5. Select an object of the linked library in the source code.
  6. Open the Javadoc view in Eclipse to check the documentation (seescreenshot).
  7. Open the source code declaration (defaultshortcut: F3)of the selected object.


Example

The example uses the Gsonlibrary.

Directory structure of the libs folder:

libs├── docs   └── gson-2.2.2-javadoc.jar├── gson-2.2.2.jar├── gson-2.2.2.jar.properties└── src    └── gson-2.2.2-sources.jar

Contents of gson-2.2.2.jar.properties

src=docs/gson-2.2.2-sources.jardoc=src/gson-2.2.2-javadoc.jar


Additional information

You can of course move the javadoc and sources .jar into otherfolders and specify relative paths. That's up to you. Placing thesource and javadoc jars directly intothe lib folderis possible but notrecommended, as that causes documentation and source codeto be includedin your application.


0 0