Android源码 模块编译
2016-02-26 18:26
429 查看
有的时候,我们需要单独编译某个模块,然后打包到 Android Rom 中去。
m: Makes from the top of the tree. (编译所有的模块 )
mm: Builds all of the modules in the current directory. (编译当前目
录下的模块,当前目录下要有Android.mk文件)
mmm: Builds all of the modules in the supplied directories. (编译指定路径下的模块,指定路径下要有Android.mk文件)
比如,我们需要编译 Settings 的源码
编译成功,会出现以下界面
记住出现的这行代码(很重要)
Install: out/target/product/lcsh6580_weg_sh_l/system/priv-app/Settings/Settings.apk
编译成功的apk输出目录在:out/target/product/lcsh6580_weg_sh_l/system/priv-app/Settings/Settings.apk
然后就可以在设备上查看运行结果啦~
打包成功~
下面就是重新刷机啦~
这样重新刷机过后,也能看到设备上新的 apk , 然后验证效果。
命令介绍
先介绍几个模块编译的命令:m: Makes from the top of the tree. (编译所有的模块 )
mm: Builds all of the modules in the current directory. (编译当前目
录下的模块,当前目录下要有Android.mk文件)
mmm: Builds all of the modules in the supplied directories. (编译指定路径下的模块,指定路径下要有Android.mk文件)
模块编译
首先,我们需要进入到源码目录下$ cd android_source_v5/alps/alps/
比如,我们需要编译 Settings 的源码
$ . build/envsetup.sh or source build/envsetup.sh 然后执行编译命令 $ mmm packages/apps/Settings
编译成功,会出现以下界面
记住出现的这行代码(很重要)
Install: out/target/product/lcsh6580_weg_sh_l/system/priv-app/Settings/Settings.apk
编译成功的apk输出目录在:out/target/product/lcsh6580_weg_sh_l/system/priv-app/Settings/Settings.apk
安装 apk 查看效果
编译完成过后,我们总需要看一下效果,有 bug 也需要 fix 的。$ adb install -r out/target/product/lcsh6580_weg_sh_l/system/priv-app/Settings/Settings.apk
然后就可以在设备上查看运行结果啦~
把模块编译的 apk 打包到真个 system.img 中去
模块编译完成,有时候需要打包到系统镜像中,然后发布给所有人用,主要是不想每个单独更新某个 apk 麻烦~$ lunch 选择你需要编译的设备源码 $ make snod 将你修改的模块打入到system.img中
打包成功~
下面就是重新刷机啦~
$ adb reboot bootloader $ fastboot flashall -w
这样重新刷机过后,也能看到设备上新的 apk , 然后验证效果。
相关文章推荐
- VLC-Android Intro - MODULE LIST
- Android中数据库的操作流程详解
- Android,水波进度条
- Xamarin.Android真机调试时闪退解决办法
- Aandroid 事件分发机制(二):ViewGroup
- Android启动过程分析——init.c(二)
- Android高手进阶:Adapter深入理解与优化
- Android 同一个数据适配器(Adapter)支持不同布局。
- VLC-Android Intro - Modules Init
- Android-Dialog
- Android-Dialog
- Android内存优化(使用SparseArray和ArrayMap代替HashMap)
- android实现无限轮播
- 解决Android M上锁屏情况下,禁止PC通过MTP访问手机存储单元
- Android 图片处理,实现蒙层效果
- Android逆向之旅---解析编译之后的classes.dex文件格式
- Android NDK 创建 Socket 失败(socket = -1)问题记录
- 【转】Android开发之ListView+EditText-要命的焦点和软键盘问题解决办法
- Android Process 详解
- Android插件化开发 第五篇 [360 Droid Plugin]