Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve API Lint error in AOSP build?

I'm using AOSP source file.I have created new service in Android 9 & it was running. When I tried to reuse the same in Android 11, getting API Lint Error from auto generated file (out folder)

1. IHelloworldService.java:43: error: Methods calling system APIs should rethrow RemoteException as RuntimeException (but do not list it in the throws clause) [RethrowRemoteException]

2. IHelloworldService.java:15: error: Raw AIDL interfaces must not be exposed: Stub extends Binder [RawAidl]

3. IHelloworldService.java:10: error: Missing nullability on method asBinder return [MissingNullability]

error window I unable to try what is emitted in the terminal, (method 1 is not possible, since autogenerated file; method 1 is not possible, since mentioned folder is not available ) API-Lint.md file Can anyone help me with how to solve this? stuck for long time

like image 277
sankar Avatar asked Aug 31 '25 04:08

sankar


2 Answers

Because it is system APIs, so you need add /** {@hide} */comment, can solve this, like this

package android.service.cfm880;
/** {@hide} */
interface IHelloService{
    void hello(in String name);
}

current newest aosp master branch can work

like image 124
Fangming Cheng Avatar answered Sep 03 '25 22:09

Fangming Cheng


You may override the bp file.Then add/override metalava_framework_docs_args section.

metalava_framework_docs_args = "
"--api-lint-ignore-prefix replace_with_your_class_name_or_prefix "
like image 28
Solskjaer49 Avatar answered Sep 03 '25 21:09

Solskjaer49