问题
编译源码时候,遇到这样的错误:
******************************
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.
******************************
还有这些问题:
经验不足,第一次遇到这些问题肯定很挠头的。
原因
根本原因是 修改了系统提供的API,所以每次编译会提示这些。
解决方案
update api 一下:执行以下命令
make update-api
make update-api 用来做什么的呢?
如果你在Android源码中添加了自定义的包、类、方法或者你修改了Android源码中标识为@hide的方法、类,你需要这些内容对 Application可见并且需要编译进SDK的Document中的话,这个命令是必须的(其实还有另外一种手工修改的方式替代这个命令的,呵呵)
新的代码源码编译。错误后执行 make update-api 。以后不会有错误。然后 找到frameworks/base/api/ current.txt
把这个文件替换代码库的frameworks/base/api/ current.txt。以后你从代码库下载最新代码就不需要 make update-api
如果你是一名上层应用工程师,实在倒腾很久也无法解决,还可能是驱动工程师差异化代码时候会覆盖了编译后更新的current.txt.所以 在差异化代码时候一定要注意,切勿掉进坑里。