Could not parse API file "frameworks / base / api / current.txt"

I tried to add some files to the android framework. Everything is going well, except at the end of the compilation I get below the error.

I tried make update-api too, but no luck, every time it compiles it gives below errors. If anyone knows how to overcome this, let me know.

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 
+7
source share
2 answers

The cause of this problem was:

Reason : - I added private classes in the Android Framework, and these documentation / declaration classes should be added to "frameworks/base/api/current.txt"

Solution : - in accordance with the error logs. There are two solutions.

1) Add @hide annotation in each method Signature in each newly added file and its members.

2) use the commands $ make update-api , then $ make -j4 or use $make update-api && make -j4 , and the code should now be compiled.

+11
source

Have you tried compiling the code before updating the api? It seems that the code you added cannot be compiled. The problem is that the new api cannot be parsed. If you check external/doclava/src/com/google/doclava/apicheck/ApiFile.java , you will find a throw instruction that can help you:

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

It seems that you are trying to add a private api to a class or interface that is not allowed. To check this, try looking at the line out/target/common/obj/PACKAGING/public_api.txt line number 6342. There you should find the name of the class or interface that causes the error.

+2
source

All Articles