关于make update-api命令
何时需要执行make update-api命令
- 添加系统API或者修改@hide的API后,需要执行
make update-api,然后再make - 修改公共api后,需要
make update-api
1.在修改完系统Api或部分公共Api后(常见于修改、等等),执行源码编译时会有如下提示
see build/core/apicheck_msg_current.txt
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update by executing the following command:
make update-api
To submit the revised to the main Android repository,
you will need approval.
******************************
2.错误信息表明是由于API错误导致
谷歌对于所有的类和API,分为开方和非开放两种,而开放的类和API,可以通过“Javadoc标签”与源码同步生成“程序的开发文档”;当我们修改或者添加一个新的API时,我们有两种方案可以避免出现上述错误.
- 其一是将该接口加上 非公开的标签:/*{@hide}/;
- 再者可以在修改后执行:make update-api(公开),将修改内容与API的doc文件更新到一致。
3.解决办法:
- 执行: make update -api ;
- 修改后相应API文件后,在base库下面会产生“.”文件的差异,提交时将该差异一并提交审核即可。