gpt4 book ai didi

android - 无法解析 API 文件 "frameworks/base/api/current.txt"

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:18:47 27 4
gpt4 key购买 nike

我尝试在 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 框架中添加私有(private)类,这些类文档/声明必须添加到 “frameworks/base/api/current.txt”

解决方案:- 根据错误日志,有两种解决方案。

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

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

关于android - 无法解析 API 文件 "frameworks/base/api/current.txt",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14622020/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com