v 执行ls -la /bin/sh命令,如果输出如下:
rwxrwxrwx 1 root root 4 2010-02-10 17:14 /bin/sh -> dash请执行$sudo dpkg-reconfigure dash命令修改sh版本,并选择“否”;此处如果不改好的话,编译时会出现错误。 v 执行source build/envsetup.sh命令v 执行choosecombo命令,出现选择对话框u Build for the simulator or the device?u 1. Deviceu 2. Simulatoru u Which would you like? [1] u u Build type choices are:u 1. releaseu 2. debugu u Which would you like? [2]u u Product choices are:u 1. coreu 2. full_dreamu 3. fullu 4. full_passionu 5. full_sapphireu 6. generic_dreamu 7. genericu 8. generic_passionu 9. generic_sapphireu 10. msm7625_qrdu 11. msm7627_ffau 12. msm7627_surfu 13. msm7630_surfu 14. qsd8250_ffau 15. qsd8250_surfu 16. sample_addonu 17. sdku 18. simu You can also type the name of a product if you know it.u Which product would you like? [generic] 3u u Variant choices are:u 1. useru 2. userdebugu 3. engu Which would you like? [eng] 如果执行这个命令的时候,报错:/bin/sh: Syntax error: “(” unexpected#请执行$sudo dpkg-reconfigure dash命令,并选择“否”; v 配置环境变量export JAVA_HOME=/usr/lib/jvm/java-5-sunexport CLASSPATH=$JAVA_HOME/libexport JRE_HOME=$JAVA_HOME/jreexport JAVA_PATH=$JAVA_HOME/bin:$JRE_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport ANDROID_JAVA_HOME=$JAVA_HOMEexport PATH=$JAVA_PATH:$PATH v 执行make命令如果安装的是java1.6,将报错,如下:Your version is: java version “1.6.0_15″.The correct version is: 1.5. 解决java编译错误,如下:1) 下载jdk1.5(ftp://202.112.80.252/java/jdk-1_5_0_21-linux-i586.bin);2) 将jdk-1_5_0_21-linux-i586.bin变为可执行权限$sudo chmod a+x jdk-1_5_0_21-linux-i586.bin3) 在命令行下执行./jdk-1_5_0_21-linux-i586.bin安装sdk4) 建立一个软连接到jdk目录$sudo ln jdk1.5.0_21/ java-5-sun -s5) 然后配置环境变量:sudo gedit/etc/enviroment在其中添加两行:CLASSPATH=/usr/lib/jvm/java-5-sun/libJAVA_HOME=/usr/lib/jvm/java-5-sun 如果在出现类似使用了旧版api的错误,请先按照提示执行make update-api命令。该命令执行结束之后,再继续执行make命令就可以编译成功了。 在配置好shell命令类型之后,也可以新建一个shell脚本如下,进行自动编译:export JAVA_HOME=/usr/lib/jvm/java-5-sunexport CLASSPATH=$JAVA_HOME/libexport JRE_HOME=$JAVA_HOME/jreexport JAVA_PATH=$JAVA_HOME/bin:$JRE_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport ANDROID_JAVA_HOME=$JAVA_HOMEexport PATH=$JAVA_PATH:$PATHsource build/envsetup.shchoosecombo 1 1 7 3makebuild之后的log如下:… …creating boot.img…creating recovery.img…creating system.img…creating userdata.img…cleaning up…Done.