编译Android源码,并用模拟器启动编译好的镜像

下载专用二进制文件

暂时还搞不清楚这个二进制文件,第一次没有下载二进制文件,启动模拟器不成功,后来下载了二进制文件,并在源码目录中解压执行,再编译后,启动模拟器就成功啦。

我选择的是这两个文件:

编译

进入Android源码目录,首先清除之前的编译:

make clobber

然后设置环境:

source build/envsetup.sh

选择编译的文件,直接输入命令:

lunch

BUILDTYPE 是以下类型之一:

编译类型使用情况
user权限受限;适用于生产环境
userdebug与“user”类似,但具有 root 权限和可调试性;是进行调试时的首选编译类型
eng具有额外调试工具的开发配置

如下:

gs@aigo:~/02_android/android9.0.0_35$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_mips-eng
     4. aosp_mips64-eng
     5. aosp_x86-eng
     6. aosp_x86_64-eng
     7. aosp_car_arm-userdebug
     8. aosp_car_arm64-userdebug
     9. aosp_car_x86-userdebug
     10. aosp_car_x86_64-userdebug
     11. mini_emulator_arm64-userdebug
     12. m_e_arm-userdebug
     13. m_e_mips64-eng
     14. m_e_mips-userdebug
     15. mini_emulator_x86_64-userdebug
     16. mini_emulator_x86-userdebug
     17. uml-userdebug
     18. aosp_crosshatch-userdebug
     19. aosp_blueline-userdebug
     20. aosp_cf_x86_auto-userdebug
     21. aosp_cf_x86_phone-userdebug
     22. aosp_cf_x86_tablet-userdebug
     23. aosp_cf_x86_tablet_3g-userdebug
     24. aosp_cf_x86_tv-userdebug
     25. aosp_cf_x86_wear-userdebug
     26. aosp_cf_x86_64_auto-userdebug
     27. aosp_cf_x86_64_phone-userdebug
     28. aosp_cf_x86_64_tablet-userdebug
     29. aosp_cf_x86_64_tablet_3g-userdebug
     30. aosp_cf_x86_64_tv-userdebug
     31. aosp_cf_x86_64_wear-userdebug
     32. cf_x86_auto-userdebug
     33. cf_x86_phone-userdebug
     34. cf_x86_tablet-userdebug
     35. cf_x86_tablet_3g-userdebug
     36. cf_x86_tv-userdebug
     37. cf_x86_wear-userdebug
     38. cf_x86_64_phone-userdebug
     39. cf_x86_64_tablet-userdebug
     40. cf_x86_64_tablet_3g-userdebug
     41. cf_x86_64_tv-userdebug
     42. cf_x86_64_wear-userdebug
     43. aosp_marlin-userdebug
     44. aosp_marlin_svelte-userdebug
     45. aosp_sailfish-userdebug
     46. aosp_walleye-userdebug
     47. aosp_walleye_test-userdebug
     48. aosp_taimen-userdebug
     49. hikey-userdebug
     50. hikey64_only-userdebug
     51. hikey960-userdebug

Which would you like? [aosp_arm-eng] 6

备注:我电脑的环境是9700k,ubuntu1804,我先选择了1和2都不行,启动emulator后,模拟器一直现实的画面是android,估计是卡住了,后来选择了6后,在模拟器中可以运行。

编译:

make -j8

启动模拟器

编译成功后,在命令中输入:

emulator

模拟器运行正常,截图:

 

这下就可以愉快的调试代码啦,

 

 

本文参考的文章:

https://source.android.google.cn/setup/building?hl=zh-cn

emulator命令详解:https://www.cnblogs.com/prayer521/p/4069056.html

 

 

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值