第一步:在已编译的android-4.4.2_r1文件夹下,找到文件development/ide/eclipse/.classpath,将之复制到android-4.4.2_r1下,.classpath内容大约如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="packages/apps/Bluetooth/src"/>
<classpathentry kind="src" path="packages/apps/Browser/src"/>
<classpathentry kind="src" path="packages/apps/Calendar/src"/>
<classpathentry kind="src" path="packages/apps/Calendar/extensions_src"/>
<classpathentry kind="src" path="packages/apps/Calculator/src"/>
<classpathentry kind="src" path="packages/apps/CertInstaller/src"/>
<classpathentry kind="src" path="packages/apps/Contacts/src"/>
<classpathentry kind="src" path="packages/apps/ContactsCommon/src"/>
<classpathentry kind="src" path="packages/apps/DeskClock/src"/>
<classpathentry kind="src" path="packages/apps/Dialer/src"/>
<classpathentry kind="src" path="packages/apps/Email/src"/>
<classpathentry kind="src" path="packages/apps/Email/emailcommon/src"/>
<classpathentry kind="src" path="packages/apps/Gallery2/src"/>
<classpathentry kind="src" path="packages/apps/Gallery2/src_pd"/>
<classpathentry kind="src" path="packages/apps/Gallery2/gallerycommon/src"/>
<classpathentry kind="src" path="packages/apps/HTMLViewer/src"/>
<classpathentry kind="src" path="packages/apps/InCallUI/src"/>
<classpathentry kind="src" path="packages/apps/Launcher2/src"/>
<classpathentry kind="src" path="packages/apps/Mms/src"/>
<classpathentry kind="src" path="packages/apps/Nfc/src"/>
<classpathentry kind="src" path="packages/apps/Nfc/nci/src"/>
<classpathentry kind="src" path="packages/apps/PackageInstaller/src"/>
<classpathentry kind="src" path="packages/apps/Phone/src"/>
<classpathentry kind="src" path="packages/apps/PhoneCommon/src"/>
<classpathentry kind="src" path="packages/apps/QuickSearchBox/src"/>
<classpathentry kind="src" path="packages/apps/Provision/src"/>
<classpathentry kind="src" path="packages/apps/Settings/src"/>
<classpathentry kind="src" path="packages/apps/SoundRecorder/src"/>
<classpathentry kind="src" path="packages/apps/Stk/src"/>
<classpathentry kind="src" path="packages/apps/VoiceDialer/src"/>
<classpathentry kind="src" path="packages/providers/CalendarProvider/src"/>
<classpathentry kind="src" path="packages/providers/ContactsProvider/src"/>
<classpathentry kind="src" path="packages/providers/DownloadProvider/src"/>
<classpathentry kind="src" path="packages/providers/DrmProvider/src"/>
<classpathentry kind="src" path="packages/providers/MediaProvider/src"/>
<classpathentry kind="src" path="packages/providers/TelephonyProvider/src"/>
<classpathentry kind="src" path="packages/screensavers/Basic/src"/>
<classpathentry kind="src" path="packages/screensavers/PhotoTable/src"/>
<classpathentry kind="src" path="packages/screensavers/WebView/src"/>
<classpathentry kind="src" path="packages/services/Telephony/src"/>
<classpathentry kind="src" path="packages/services/Telephony/common/src"/>
<classpathentry kind="src" path="frameworks/base/cmds/am/src"/>
<classpathentry kind="src" path="frameworks/base/cmds/input/src"/>
<classpathentry kind="src" path="frameworks/base/cmds/pm/src"/>
<classpathentry kind="src" path="frameworks/base/cmds/svc/src"/>
<classpathentry kind="src" path="frameworks/base/core/java"/>
<classpathentry kind="src" path="frameworks/base/drm/java"/>
<classpathentry kind="src" path="frameworks/base/graphics/java"/>
<classpathentry kind="src" path="frameworks/base/icu4j/java"/>
<classpathentry kind="src" path="frameworks/base/keystore/java"/>
<classpathentry kind="src" path="frameworks/base/location/java"/>
<classpathentry kind="src" path="frameworks/base/location/lib/java"/>
<classpathentry kind="src" path="frameworks/base/media/java"/>
<classpathentry kind="src" path="frameworks/base/media/tests/MediaFrameworkTest/src"/>
<classpathentry kind="src" path="frameworks/base/media/mca/effect/java"/>
<classpathentry kind="src" path="frameworks/base/media/mca/filterfw/java"/>
<classpathentry kind="src" path="frameworks/base/media/mca/filterpacks/java"/>
<classpathentry kind="src" path="frameworks/base/nfc-extras/java"/>
<classpathentry kind="src" path="frameworks/base/obex"/>
<classpathentry kind="src" path="frameworks/base/opengl/java"/>
<classpathentry kind="src" path="frameworks/base/packages/FusedLocation/src"/>
<classpathentry kind="src" path="frameworks/base/packages/SettingsProvider/src"/>
<classpathentry kind="src" path="frameworks/base/packages/SystemUI/src"/>
<classpathentry kind="src" path="frameworks/base/policy/src"/>
<classpathentry kind="src" path="frameworks/base/sax/java"/>
<classpathentry kind="src" path="frameworks/base/services/java"/>
<classpathentry kind="src" path="frameworks/base/telephony/java"/>
<classpathentry kind="src" path="frameworks/base/test-runner/src"/>
<classpathentry kind="src" path="frameworks/base/wifi/java"/>
<classpathentry kind="src" path="frameworks/ex/carousel/java"/>
<classpathentry kind="src" path="frameworks/ex/camera2/public/src"/>
<classpathentry kind="src" path="frameworks/ex/chips/src"/>
<classpathentry kind="src" path="frameworks/ex/common/java"/>
<classpathentry kind="src" path="frameworks/ex/photoviewer/src"/>
<classpathentry kind="src" path="frameworks/ex/variablespeed/src"/>
<classpathentry kind="src" path="frameworks/opt/calendar/src"/>
<classpathentry kind="src" path="frameworks/opt/telephony/src/java"/>
<classpathentry kind="src" path="frameworks/opt/mms/src/java"/>
<classpathentry kind="src" path="frameworks/opt/net/voip/src/java"/>
<classpathentry kind="src" path="frameworks/opt/vcard/java"/>
<classpathentry kind="src" path="frameworks/support/renderscript/v8/java/src"/>
<classpathentry kind="src" path="frameworks/support/v13/java"/>
<classpathentry kind="src" path="frameworks/support/v13/ics"/>
<classpathentry kind="src" path="frameworks/support/v13/ics-mr1"/>
<classpathentry kind="src" path="development/samples/ApiDemos/src"/>
<classpathentry kind="src" path="development/samples/ApiDemos/tests/src"/>
<classpathentry kind="src" path="development/samples/Compass/src"/>
<classpathentry kind="src" path="development/samples/HelloActivity/src"/>
<classpathentry kind="src" path="development/samples/HelloActivity/tests/src"/>
<classpathentry kind="src" path="development/samples/Home/src"/>
<classpathentry kind="src" path="development/samples/LunarLander/src"/>
<classpathentry kind="src" path="development/samples/LunarLander/tests/src"/>
<classpathentry kind="src" path="development/samples/NotePad/src"/>
<classpathentry kind="src" path="development/samples/NotePad/tests/src"/>
<classpathentry kind="src" path="development/samples/RSSReader/src"/>
<classpathentry kind="src" path="development/samples/SkeletonApp/src"/>
<classpathentry kind="src" path="development/samples/SkeletonApp/tests/src"/>
<classpathentry kind="src" path="development/samples/Snake/src"/>
<classpathentry kind="src" path="development/samples/Snake/tests/src"/>
<classpathentry kind="src" path="libcore/dalvik/src/main/java"/>
<classpathentry kind="src" path="libcore/json/src/main/java"/>
<classpathentry kind="src" path="libcore/libdvm/src/main/java"/>
<classpathentry kind="src" path="libcore/luni/src/main/java"/>
<classpathentry kind="src" path="libcore/xml/src/main/java"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/ApiDemos_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/Browser_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/CalendarProvider_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/ContactsProvider_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/Gallery2_intermediates/src/renderscript/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/MediaProvider_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/Music_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/Phone_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/QuickSearchBox_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/SystemUI_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/src/renderscript/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/keystore/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/location/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/media/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/telephony/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/wifi/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/NfcLogTags_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/services_intermediates/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/src/src/java"/>
<classpathentry kind="src" path="out/target/common/R"/>
<classpathentry kind="src" path="pdk/apps/TestingCamera2/src"/>
<classpathentry kind="src" path="external/apache-http/src"/>
<classpathentry kind="src" path="external/bouncycastle/bcprov/src/main/java"/>
<classpathentry kind="src" path="external/guava/guava/src"/>
<classpathentry kind="src" path="external/hamcrest/src"/>
<classpathentry kind="src" path="external/junit/src"/>
<classpathentry kind="src" path="external/libphonenumber/java/src"/>
<classpathentry kind="src" path="external/mockito/src"/>
<classpathentry kind="src" path="external/mp4parser/isoparser/src/main/java"/>
<classpathentry kind="src" path="external/nist-sip/java"/>
<classpathentry kind="src" path="external/tagsoup/src"/>
<classpathentry kind="src" path="external/xmp_toolkit/XMPCore/src"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes-jarjar.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar"/>
<classpathentry kind="lib" path="packages/apps/Calculator/arity-2.1.2.jar"/>
<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/junit-runner_intermediates/javalib.jar"/>
<classpathentry kind="output" path="out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes"/>
</classpath>
第二步:检查.classpath里的文件,确认path对应的路径存在,不存在则将classpathentry删除。
第三步:在eclipse新建Java Project,命名自取,选择已存在的工程即可:
当然,截图的时候用的是android5.0,android4.4也是一样使用。
点击Next后eclipse会帮忙检查classpath的正确性,若有提示错误,则将.classpath中的内容删除,然后返回上一步,再点击Next,直到不再提示。