何時需要執行make update-api命令
添加系統API或者修改@hide的API後,需要執行
make update-api,然後再make
修改公共api後,需要
make update-api
1.在修改完系統Api或部分公共Api後(常見於修改Intent.java、KeyEvent.java等等),執行源碼編譯時會有如下提示
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 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.錯誤信息表明是由於API錯誤導致
谷歌對於所有的類和API,分爲開方和非開放兩種,而開放的類和API,可以通過“Javadoc標籤”與源碼同步生成“程序的開發文檔”;當我們修改或者添加一個新的API時,我們有兩種方案可以避免出現上述錯誤.
其一是將該接口加上 非公開的標籤:/*{@hide}/;
再者可以在修改後執行:make update-api(公開),將修改內容與API的doc文件更新到一致。
3.解決辦法:
執行:
make update -api ;
修改後相應API文件後,在base庫下面會產生“.current.txt”文件的差異,提交時將該差異一併提交審覈即可。