android – 无法解析API文件“frameworks / base / api / current.txt”

前端之家收集整理的这篇文章主要介绍了android – 无法解析API文件“frameworks / base / api / current.txt”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我尝试在 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

解决方法

这个问题的原因是,

原因: – 我在Android框架中添加私有类,这些类文档/声明必须添加到“frameworks / base / api / current.txt”

解决方案: – 根据错误日志,有两种解决方案.

1)在每个新添加文件及其成员的每个方法的签名中添加@hide注释.

2)使用命令$make update-api然后使用$make -j4或使用$make update-api&& make -j4,代码现在应该可以编译.

猜你在找的Android相关文章