Android development tips: view the source code of external dependent jar _ android private libralies does not allow modifications to source
When developing android applications in Eclipse, you sometimes want to view the internal implementation of the function, but when you click ctrl and the left mouse button on the function,
The following message appears:
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.
The most common is that the android-support-v4 can not see the comments and source code, put the mouse on the class prompt:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc cocould be found.
Generally, if the environment is configured, all classes and methods of Android can see their code and comments. The following two steps are taken to correctly configure the comments and codes.
1. source code of the Android jar package
Assume that all the files to be downloaded have been downloaded. Right-click Project ====, build path ===, configure build path
In libraries, select Android x. x. x to include Android. jar. This is the jar package of the Android sdk that is dependent on during development. Click it and there are two configuration items in it,
Source attachment and javadoc location. The former is the source code. After configuration, you can click ctrl + the left mouse button to open the Android class you want to see,
The latter is the source code comment file. After the configuration is complete, you can move the mouse over the class you want to see. The introduction of this class or method is displayed.
Select the source attachment configuration item, click edit on the right, select external location = "external folder, and find the correct path. In E: /eclipse/sdk/sources/android-19
Select the javadoc location configuration item, edit, select javadoc url ==" browse, and find the correct path. In file:/E:/eclipse/sdk/docs/reference
After completing the above steps, you can view the common class comments and source code in Android.
2. view the source code of the external dependent jar package
Suppose that you have correctly imported and compiled the jar package on which the external dependency is located, but ctrl + left mouse click to view the code or comment it is not feasible,
First, find the introduced package under libs, here the android-support-v4.jar as an example,
Create a new android-support-v4.jar.properties file under libs, that is, the file with. properties appended to the referenced jar package with the same name
The content is as follows:
Src = E: \ eclipse \ sdk \ extras \ android \ support \ v4 \ src
Here, the path should be adjusted according to your own path. After configuration, exit eclipse. After entering, you can view it normally.
Author: jason0539
Weibo: http://weibo.com/2553717707
Blog: http://blog.csdn.net/jason0539 (reprinted please explain the source)