First, download the source code corresponding to your Android SDK
The following website has various source code versions:
Http://rgruet.free.fr/public/
android-1.5-cupcake-src.zip
04-Oct-2009 03:07 21.6M
android-1.6_r1-donut-src.zip
04-Oct-2009 03:02 22.9M
android-2.0-eclair-src.zip
21-Nov-2009 01:21 24.4M
android-2.1-eclair-src.zip
06-Jul-2010 13:08 30.2M
android-2.2-froyo-src.zip
06-Jul-2010 12:59 33.4M
Then, create the sources directory under the corresponding SDK version directory and decompress the code to the sources directory so that Eclipse can directly identify the source code.
Why is this directory?
View
Windows-> Preferences-> Java Build Path-> Libraries-> Android
2. X-> android. jar-> Source attachment
My steps:
Download:
Http://rgruet.free.fr/public/android-2.1-eclair-src.zip
My SDK_HOME
Yes:/home/app/android-sdk/
Create the source Directory:/home/app/android-sdk/platforms/android-2.1_r01-linux/sources
The following is my directory structure:
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/android
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/com
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dalvik
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dasm
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/data
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dex
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dot
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dxc
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/dxconvext
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/jar
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/java
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/java_cup
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/javax
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/jdiff
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/jp
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/junit
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/mock_android
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/org
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/other
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/otherpackage
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/otherpkg
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/proguard
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/signature
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/spechelper
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/SQLite
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/src
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/sun
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/targets
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/testprogress2
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/tests
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/util
/home/app/android-sdk/platforms/android-2.1_r01-linux/sources/LICENSE
From: http://www.herbertyang.com/