Simple Eclipse Association support. v4 source code, eclipsesupport. v4
Recently, many people have asked me how to use v4 package APIs. In fact, these Apis can be solved through associated source code. However, many people will find that when we press ctrl and click the corresponding method or class, we cannot view it, and there is no associated source code button item. You cannot perform any operations.
As shown in:
So how can we correctly associate other source code such as v4, v7, and support? The following is a simple example. Perform operations on windows and Mac respectively. The procedure is similar, but the interface is slightly different. Here, we will only elaborate on win8.1. You can associate them according to the procedure.
1. Windows (win8.1): 1.1. Right-click Eclipse and select the project to be associated. Alternatively, use the shortcut key Alt + Enter to open the option menu and select Properties.
1.2 perform operations on the project properties page as shown in the figure below. Note: in step 3, some people may encounter gray issues that cannot be clicked when removing the image. In this case, you need to click Android Private Libraries to Remove the image.
1.3 after removing the jar package file of v4 under the project, we need to add a local v4 package. Otherwise, an error will be reported when the v4 Package content is introduced to the project. Click Add External JARs to find the v4 package under the sdk. Generally {sdk_home}/extras/android/support/v4 can be searched based on the source code.
PS: note that you can switch to the Order And Export interface And check the imported jar. If this parameter is not checked, the packaged file will report that the class cannot be found. The notes here are very obscure and not easy to find. Many people do not know why v4 is clearly introduced, and no error is reported during compilation, but an exception cannot be found for the class will occur when the code is run. The reason is here. Another point is that sometimes there is a dependency order, so we need to introduce something first before introducing it. It is also very important.
1.4 close the project properties page. Press ctrl again and click the mouse. Then, you will find that the first figure still appears, however, you will find an additional Attach Source button.
1.5 click Attach Source to find the Source code under the sdk directory, that is, {sdk_home}/extras/android/support/v4 in step 3 to associate the Source code. Select External location, select External Folder, find the source code location, and click OK.
1.6 after the operation is successful, we can see that the v4 source code has been successfully displayed. Success.