调试android源码
一、编译android源代码(不叙述)
二、将源代码导入Eclipse
1.拷贝.classpath,注意如果是共享目录在windows上,这个.classpath文件是隐藏得,在linux底下也要用命令ls -a才能看到
进入gingerbread源代码目录,也就是上面的android_gingerbread_src。
$cd android_gingerbread_src
$cp ./development/ide/eclipse/.classpath ./
将.classpath设置为可写
$chmod +w .classpath
2.新建Eclipse工程
运行Eclipse,选择File->New->Java Project,项目位置就选择android_gingerbread_src根目录,导入成功以后,Eclipse开始编译源代码,不过会报告两个错误,如下:
Project'gingerbread' is missing required library:'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar'
Project'gingerbread' is missing required library:'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar'
删除.classpath中的这两行路径:
<classpathentrykind="lib"path="out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar"/>
<classpathentrykind="lib"path="out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar"/>
添加
<classpathentrykind="lib"path="out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar"/>
3.refresh工程,重新build(clean)。