I have read a lot about how to associate the android source code with the eclipse Development Environment During Android app development on the Internet, but I found that the download link provided is invalid, either there is a big difference between the methods actually described on the blog and the methods that are actually practical and effective. So here I will summarize my solution to this problem, just to leave some ideas for myself and take work notes!
I. symptom:
When you view the code in the main eclipse window, press Ctrl and click the left mouse button. To view the definition of standard class interfaces in Android, the following window is displayed:
For the above symptoms, see the solution below.
Ii. solution:
Click the "Attach source..." button, and the input box is displayed:
Click external file..., find the downloaded local file: android-xxx-src.zip or android-xxx-src.jar, and click OK.
XXX is the corresponding Android version. Pay attention to the corresponding version. If your project properties are as follows:
Enter android-2.2-froyo-src.zip or android-2.2-src.zip in the input box. Android. jar of other versions corresponds to the source code of the corresponding version.
For the download location of the source code package *. Zip or *. Jar corresponding to the Android version, see your csdn download resource. For details, see "3 ".
If you want to change the corresponding source code package in the future, you can do the following: In the eclipse view, click "project"> "properties" and locate the following position:
Click "Edit..." to change the *. Zip or *. Jar location corresponding to the source code.
3. Download link:
My local simulator has the following versions:
Therefore, the download link for the corresponding version is:
Android 1.5: http://download.csdn.net/detail/duanyipeng/3730190
Android 1.6: http://download.csdn.net/detail/duanyipeng/3730192
Android 2.1: http://download.csdn.net/detail/duanyipeng/3730193 or http://download.csdn.net/detail/duanyipeng/3730195
Android 2.2: http://download.csdn.net/detail/duanyipeng/3730197 or http://download.csdn.net/detail/duanyipeng/3730202
Android 2.3: http://download.csdn.net/detail/duanyipeng/3730206
Android 2.3.1: http://download.csdn.net/detail/duanyipeng/3730203
Android 2.3.3: http://download.csdn.net/detail/duanyipeng/3730205
The android source code package of version 3.0 and Version 3.1 is not downloaded from the Internet. Therefore, there is no corresponding download link.
Iv. Advantages and Disadvantages:
After Android. jar is associated with the source code package of the corresponding version, you can easily view the code when Android is started. However, there is also a drawback: each time you open eclipse, the SDK content will be loaded, and the time will be spent, and the eclipse startup time will grow. It may take about 1 minute to configure the machine.
========================================================== ============
Method for associating android-support-v4.jar source code:
Http://stackoverflow.com/questions/8543225/android-support-library-v4-getting-the-source-and-attaching-it-to-the-library/13269836#13269836
- Goto "configuration build path"
- Add external jars>
YourProject/libs/android-support-v4.jar
(I
Know your project had already referenced to it but don't worry, just add it again ).
- Attache source to the external jar:
android-sdk/extras/android/support/v4/src
- Switch to the "Order and export" tab, pull up the External jar above the "android dependencies"
Android source code of each version:
Http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/
Click any version on the Right To download *. jar and *-source. jar.