技术标签: Android11 源码修改 android lint检查
从 10.0 移植了几个类过来,没想到一编译出来几十个 errors,这就很离谱,明明是现成的代码。
后来仔细看了错误 log 提示,Your API changes are triggering API Lint warnings or errors
详细 log 如下
26 new API lint issues were found.
See tools/metalava/API-LINT.md for how to handle these.
************************************************************
Your API changes are triggering API Lint warnings or errors.
To make these errors go away, fix the code according to the
error and/or warning messages above.
If it is not possible to do so, there are workarounds:
1. You can suppress the errors with @SuppressLint("<id>")
2. You can update the baseline by executing the following
command:
cp \
"/home/xxx/android11.0/8788/alps/out/soong/.intermediates/frameworks/base/api-stubs-docs/android_common/api_lint_baseline.txt" \
"/home/xxx/android11.0/8788/alps/frameworks/base/api/lint-baseline.txt"
To submit the revised baseline.txt to the main Android
repository, you will need approval.
************************************************************
[ 45% 4001/8864] //frameworks/base:test-api-stubs-docs metalava merged [common]
那就按照提示,把 out 下的 api_lint_baseline.txt copy 到 frameworks/base/api/lint-baseline.txt
再次编译没啥变化,还是一样的错误提示。网上找了这篇
看评论里说的如果 lint-baseline.txt 不生效,去检查 frameworks/base/StubLibraries.bp 中是否有添加依赖。
后来我把依赖加进去后,再次编译错误提示变了,有点类似需要执行
make api-stubs-docs-non-updatable
make api-stubs-docs-non-updatable-update-current-api
make api-stubs-docs-update-current-api
但是执行了以后好像错误依旧。
根据错误 log 提示找到对应地方添加 @SuppressLint("")
frameworks/base/core/java/android/hardware/player/AndroidPlayer.java:63: error: Registration methods should have overload that accepts delivery Executor: `AndroidPlayer` [ExecutorRegistration]
frameworks/base/core/java/android/hardware/player/CodecPlayerImpl.java:16: error: Don't expose your implementation details: `CodecPlayerImpl` ends with `Impl` [EndsWithImpl]
frameworks/base/core/java/android/hardware/player/CodecPlayerImpl.java:62: error: Registration methods should have overload that accepts delivery Executor: `CodecPlayerImpl` [ExecutorRegistration]
frameworks/base/core/java/android/hardware/player/CodecPlayerImpl.java:496: error: Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision, was `getVsyncDurationNanos` [MethodNameUnits]
frameworks/base/core/java/android/hardware/player/MediaCodecPlayer.java:34: error: Registration methods should have overload that accepts delivery Executor: `MediaCodecPlayer` [ExecutorRegistration]
frameworks/base/core/java/android/hardware/player/MediaCodecPlayer.java:15: error: All constants must be defined at compile time: android.hardware.player.MediaCodecPlayer#PLAY_TIME_MS [CompileTimeConstant]
frameworks/base/core/java/android/hardware/player/MediaTimeProvider.java:9: error: Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision, was `getVsyncDurationNanos` [MethodNameUnits]
frameworks/base/core/java/android/hardware/player/VideoFrameReleaseTimeHelper.java:91: error: Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision, was `getVsyncDurationNanos` [MethodNameUnits]
8 new API lint issues were found.
See tools/metalava/API-LINT.md for how to handle these.
************************************************************
Your API changes are triggering API Lint warnings or errors.
To make these errors go away, fix the code according to the
error and/or warning messages above.
If it is not possible to do so, there are workarounds:
1. You can suppress the errors with @SuppressLint("<id>")
2. You can add a baseline file of existing lint failures
to the build rule of api-stubs-docs-non-updatable.
************************************************************
import android.annotation.NonNull;
import android.annotation.SuppressLint;
导入上面这两个包
@SuppressLint("") 中的 id 就是错误 log 中的 [xxxxxx]
@NonNull 也可以用 @SuppressLint(“MissingNullability”)
具体修改
CodecPlayerImpl.java:62: error: Registration methods should have overload that accepts delivery Executor: CodecPlayerImpl
[ExecutorRegistration]
@SuppressLint("ExecutorRegistration")
public CodecPlayerImpl(@NonNull Surface surface,
@NonNull ImageReader imageReader,
double defaultDisplayRefreshRate, boolean AudioDecodeOnly,
@NonNull CodecState.OnVideoImageAvailablelistener onVideoImageAvailablelistener,
@NonNull OnCodecErrorListener onCodecErrorListener){
CodecPlayerImpl.java:496: error: Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision, was getVsyncDurationNanos
[MethodNameUnits]
@SuppressLint("MethodNameUnits")
public long getVsyncDurationNanos() {
if (mFrameReleaseTimeHelper != null) {
return mFrameReleaseTimeHelper.getVsyncDurationNanos();
} else {
return -1;
}
}
pandas常用操作1、修改表头import pandas as pddf = pd.DataFrame({'a':[1,2,3],'b':[1,2,3]}) a b0 1 11 2 22 3 31、修改列名a,b为A、B。df.columns = ['A','B']2、只修改列名a为Adf.rename(columns={'a':'A'})_pandas 表头
介绍一下这个很炫的插件吧比如你在敲for循环,妹子就会说:比如你在敲for循环,妹子就会说:比如你在敲for循环,妹子就会说:啊,你是在遍历你的鱼塘吧?......啊,你是在遍历你的鱼塘吧?......啊,你是在遍历你的鱼塘吧?......关键是,声音很萌有木有啊啊啊啊啊啊关键是,声音很萌有木有啊啊啊啊啊啊关键是,声音很萌有木有啊啊啊啊啊啊~~~如何下载?\color{Red}如何下载?如何下载?这个插件暂时没有在viscode商店上架这个插件暂时没有在viscode商店上架这个插件暂时没有在vi
极坐标其实很简单,但总有同学在应用的时候出现问题。所以干脆从头到尾来梳理一下极坐标的相关问题。这个笔记有点长,所以还是弄个目录,虽然没法跳转但也好过一直拉拉拉拉。。。目 录—、极坐标的基本概念二、极坐标和直角坐标的转换三、直角坐标系下的曲线方程转换为极坐标系下的曲线方程 (1)圆心在原点的圆: (2)圆心过原点的椭圆方程: (3)直线四、对称中心不在原..._t1-t2极坐标
1.空指针。2.数组越界。list.get(o),或数组array[0]。3.除以0 。这些操作前都应判断4.内存溢出(GUI常出现)。
安装Java环境: jdk安装: jdk安装与环境搭建 jdk还是建议官网下载, 选择最底下的“windows X86”(32位)或者“windows X64”(64位)下载 到 官网 下载 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.h_eclipe-jee-2020-06-rwin32-x86_64.zip
matlab求解路径优化及选址综合考量问题。采用多目标遗传算法能够得到多个可行解_遗传算法选址问题
1.首先 闲话不说 直接代码走起,都是我工作闲事的积累干货//重要 js 运行 $(function (){ 代码 });2.ajax 传值//第一种输入框 <input type="text" data-upload="Descript" value="" />$(function () { $('#btn').click(fun...
简单介绍一下数据库概念1.数据库(Database)数据库(Database)是按照数据结构来组织、存储和管理数据的仓库,当前使用最多的是关系型数据库,常见数据库软件包括:oracle,mysql,postgresql,DB2,SQL SERVER....数据库管理系统(Database Management System)2.数据库管理系统(Database_连接池、数据源、jndi
天萃荷净Oracle EM组件中EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS维护命令大全1、建立Oracle EM包1.1)emd_maintenance包exec sysman.emd_maintenance.submit_em_dbms_jobs;commit;1.2)创建jobDECLAREX NUMBER;BEGINSYS.DBMS_JOB.SUBMI..._emd_maintenance
现在企业招聘人才的时候选择标准不断提高,技术能力不饱和的同学们因此面临着极大的挑战。磨砺营的同事收集了大量的面试题来帮助大家,今天我们一起来看看这些竞聘的Android面试题,你是不是已经都了解了!1.Android中的Context, Activity,Appliction有什么区别? 相同:Activity和Application都是Context的子类。_两个 activity 之间传递数据,除了 intent,广播接收者,content provider 还有啥?
JavaScript WebAPI学习事件高级注册事件注册事件分为两种方式:传统注册方式和监听注册方式传统注册事件特点:注册事件唯一性 (同一个元素同一个事件只能设置一个处理函数,后注册的函数回把先注册的给覆盖掉)<body> <button>传统注册事件</button> <script> var btn = d..._js发送api的小dmeo
安装Git :自带ssh打开vscode:安装插件 Remote Development按F1,输入:>Remote-SSH:Open Configuration File然后提示选择:C:\Users\***\.ssh自动生成文件:config修改文件内容如下# Read more about SSH config files: https://lin...