make update-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.
******************************

還有這些問題:
在這裏插入圖片描述

經驗不足,第一次遇到這些問題肯定很撓頭的。

原因

根本原因是 修改了系統提供的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.所以 在差異化代碼時候一定要注意,切勿掉進坑裏。

參考文章:下載並編譯android-4.3_r1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章