为何要make update -api

来源:互联网 发布:统一网络加速器 编辑:程序博客网 时间:2024/05/19 04:54

转自:http://blog.csdn.net/balabala_2xiaomoxian/article/details/50820255

最近修改了framework/base/media 路径下的Java文件,导致全编报错

1.错误信息类似
............
******************************
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 current.txt by executing the following command:
         make update-api
      To submit the revised current.txt to the main Android repository,
      you will need approval.
******************************
...........

2.问题原因分析和解决办法

2.1.错误信息表明是由于API错误导致, 进一步研究发现:谷歌对于所有的类和API,分为开方和非开放两种,而开放的类和API,可以通过“Javadoc标签”与源码同步生成“程序的开发文档”;当我们修改或者添加一个新的API时,我们有两种方案可以避免出现上述错误,其一是将该接口加上 非公开的标签:/**{@hide}*/;再者可以在修改后执行:make update-api(公开),将修改内容与API的doc文件更新到一致。 

2.2解决办法:
1>执行: make update -api ;
2>修改后相应API文件后,在base库下面会产生“.current.txt”文件的差异,提交时将该差异一并提交审核即可。

原创粉丝点击