8

我尝试在 Android 框架中添加一些文件。一切顺利,除了在编译结束时我遇到错误。

我也尝试过 make update-api ,但没有运气,每次编译时都会出现以下错误。如果有人知道如何克服这个问题,请告诉我。

Docs droiddoc: out/target/common/docs/doc-comment-check
Checking API: checkapi-last
Checking API: checkapi-current
host layoutlib_create: out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
Couldn't parse API file "frameworks/base/api/current.txt"
  ...as text: com.google.doclava.apicheck.ApiParseException: missing class or interface. got: private line 6342
  ...as XML:  com.google.doclava.apicheck.ApiParseException: Error parsing API
Couldn't parse API file "out/target/common/obj/PACKAGING/public_api.txt"
  ...as text: com.google.doclava.apicheck.ApiParseException: missing class or interface. got: private line 6342
  ...as XML:  com.google.doclava.apicheck.ApiParseException: Error parsing API
Exception in thread "main" java.lang.NullPointerException
    at com.google.doclava.apicheck.ApiCheck.checkApi(ApiCheck.java:118)
    at com.google.doclava.apicheck.ApiCheck.main(ApiCheck.java:67)

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



Couldn't parse API file "out/target/common/obj/PACKAGING/public_api.txt"
  ...as text: com.google.doclava.apicheck.ApiParseException: missing class or interface. got: private line 6342
  ...as XML:  com.google.doclava.apicheck.ApiParseException: Error parsing API
Exception in thread "main" java.lang.NullPointerException
    at com.google.doclava.apicheck.ApiInfo.isConsistent(ApiInfo.java:60)
    at com.google.doclava.apicheck.ApiCheck.checkApi(ApiCheck.java:118)
    at com.google.doclava.apicheck.ApiCheck.main(ApiCheck.java:67)

******************************
You have tried to change the API from what has been previously released in
an SDK.  Please fix the errors listed above.
******************************


make: *** [out/target/common/obj/PACKAGING/checkapi-last-timestamp] Error 38
make: *** Waiting for unfinished jobs....
make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38
-rw-r--r-- 1 aankit admin 9763299 Jan 31 14:21 out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
Output: out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
Input :      out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar
Input :      out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
Found 7983 classes in input JARs.
Found 2260 classes to keep, 2143 class dependencies.
# deps classes: 2143
# keep classes: 2260
# renamed     : 19
Created JAR file out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
4

2 回答 2

12
于 2013-07-29T06:10:03.393 回答
2

您是否尝试过在更新 api 之前编译代码?您添加的代码似乎无法编译。问题是无法解析新的api。如果你检查一下external/doclava/src/com/google/doclava/apicheck/ApiFile.java,你会发现可以帮助你的 throw 语句:

throw new ApiParseException("missing class or interface. got: " + token, tokenizer.getLine());

似乎您尝试添加不允许的 api私有类或接口。要检查这一点,请尝试查看out/target/common/obj/PACKAGING/public_api.txt文件行号 6342。在那里您应该找到导致错误的类或接口的名称。

于 2013-02-04T12:30:16.690 回答