Не удалось разобрать файл API " Framework / base/api / current.формат txt"

Я попытался добавить некоторые файлы в Android framework. Все идет хорошо, за исключением того, что в конце компиляции я получаю ниже ошибки.

Я тоже пытался сделать 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

2 ответов


причиной этого вопроса было,

причина : - я добавлял частные классы в рамках Android, и эти классы документация / объявления должны быть добавлены в “frameworks/base/api/current.txt”

решение : - согласно журналам ошибок, существует два решения.

1) добавить @hide Аннотация В каждой method's Signature в каждом новом файле и его членах.

2) использовать команды $ make update-api затем $ make -j4 или использовать $make update-api && make -j4 , и код надо теперь компилируется.


вы пытались скомпилировать код перед обновлением 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. Там вы должны найти имя класса или интерфейса, который вызвать ошибку.