谷歌对于所有的类和API,分为开放和非开放两种,当我们修改framework目录中的java文件时,比如添加API、删除API、声明变量,编译器都需要我们决定API是开放还是非开放。
对于开放的类和API,可以通过“Javadoc标签”与源码同步生成“程序的开发文档”,方便开发者查看接口说明,同步生成“程序的开发文档”的方法就是先执行 make update-api (编译会修改文件 framework/base/api/current.txt),再执行大编译 make -j4 。
对于非开放的类和API,将该接口加上非公开的标签:/**{@hide}*/
如果不做上述处理,在添加新API时会报如下错误:
******************************
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.
******************************