android中关于class Build以及如何修改android固件版本号
16lz
2021-12-04
在frameworks/base/core/java/android/os/Build.java中定义了class Build类,这个类定义了所有关于产品的参数,例如固件版本号,product 名字,板子名字等等,有些参数会在设置->关于手机中显示。
public class Build { /** Value used for when a build property is unknown. */ public static final String UNKNOWN = "unknown"; /** Either a changelist number, or a label like "M4-rc20". */ public static final String ID = getString("ro.build.id"); /** A build ID string meant for displaying to the user */ public static final String DISPLAY = getString("ro.build.display.id"); /**a firmware realse */ public static final String FIRMWARE = getString("ro.product.firmware"); /** The name of the overall product. */ public static final String PRODUCT = getString("ro.product.name"); /** The name of the industrial design. */ public static final String DEVICE = getString("ro.product.device"); /** The name of the underlying board, like "goldfish". */ public static final String BOARD = getString("ro.product.board"); /** The name of the instruction set (CPU type + ABI convention) of native code. */ public static final String CPU_ABI = getString("ro.product.cpu.abi"); /** The name of the second instruction set (CPU type + ABI convention) of native code. */ public static final String CPU_ABI2 = getString("ro.product.cpu.abi2"); /** The manufacturer of the product/hardware. */ public static final String MANUFACTURER = getString("ro.product.manufacturer"); /** The brand (e.g., carrier) the software is customized for, if any. */ public static final String BRAND = getString("ro.product.brand");
因此,如果想修改这些参数,只要在修改相关的参数就可以了。例如,如果想修改固件版本号,那么找到定义ro.product.firmware的文件(在我做的项目里,是./device/softwinner/crane-gm-g9/crane_gm_g9.mk),修改成想要的版本号,就可以了。
要注意的是,在重新编译的时候,首先要先删掉./out/target/product/crane-gm-g9/recovery/root/default.prop和./out/target/product/crane-gm-g9/system/build.prop再编译才能生效。否则,这个build不一定能重新编译,因为改的是mk文件本身,而不是.java。
更多相关文章
- mybatisplus的坑 insert标签insert into select无参数问题的解决
- Python技巧匿名函数、回调函数和高阶函数
- python list.sort()根据多个关键字排序的方法实现
- Android中使用animation的方法
- Android封装jar包,把当前项目设置成module,封装手机振动jar包给uni
- 在网址中跳转APP(进入XXXAPP内查看)
- android studio修改配置文件(.android .gradle .AndroidStudio)
- Android(安卓)UI设计——ListView控件与SimpleAdapter适配器(三)
- Android(安卓)UI设计——ListView控件与SimpleAdapter适配器(三)