關於修改frameworks的源碼遇到的一點問題以及解決方法

關於修改frameworks的源碼遇到的一點問題以及解決方法

這兩天由於項目需要,更改了Notification的源碼,結果在Linux上make時出現例如下面提示:
Checking API: checkapi-current
(unknown): error 5: Added public field android.app.Notification.mContent
******************************
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.xml by executing the following command:
         make update-api
      To submit the revised current.xml to the main Android repository,
      you will need approval.
******************************
之後查了下,發現原因是:
google對於所有的類和API,分爲開放式和不開放式兩種。所謂的開放式就是值javadoc所包含的,並不是java中有public和private,而是跟javadoc有關係,代碼沒有關係。
而我這次的錯誤提示是因爲在開放式的類中增加了一個變量,而又沒隱藏,導致和原API的doc不一致造成的。
通過提示,有2個方法可以解決該問題:
1、將新增加的變量或方法加上"@hide" 的註釋,注意一點,加"@hide" 不是簡簡單單的/*@hide */就行了,標準的javadoc要這樣 /**  */ 而且對於 format 變量 應該加上 {  },也就是/**{@hide}*/
2、如果想在生成的doc中增加該變量或方法的話,必須輸入:
make update-api
這樣的話,系統自動將新增加的API添加到current.xml中了。
不過我用的是第一種方法,第二種我沒有試驗過,關鍵編譯一次時間太長了。。。
希望通過本次說明,能讓各位和我一樣修改frameworks的兄弟有所幫助。

本文轉載至: http://www.eoeandroid.com/thread-16096-1-5.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章