android - 为什么当我删除 @SuppressLint("RestrictedApi") 时,Android Studio 会显示“只能从同一个库组中调用”?
问题描述
代码 A来自CameraX项目,您可以查看源代码。
当我删除时,Android Studio 会显示“只能从同一个库组调用” @SuppressLint("RestrictedApi")
,你可以看到图 1。
为什么我不能 @SuppressLint("RestrictedApi")
在Code A中删除?deos 限制 API 是什么意思?
代码 A
@SuppressLint("RestrictedApi")
private fun updateCameraUi() {
...
// Listener for button used to switch cameras
controls.findViewById<ImageButton>(R.id.camera_switch_button).setOnClickListener {
lensFacing = if (CameraX.LensFacing.FRONT == lensFacing) {
CameraX.LensFacing.BACK
} else {
CameraX.LensFacing.FRONT
}
try {
// Only bind use cases if we can query a camera with this orientation
CameraX.getCameraWithLensFacing(lensFacing)
// Unbind all use cases and bind them again with the new lens facing configuration
CameraX.unbindAll()
bindCameraUseCases()
} catch (exc: Exception) {
// Do nothing
}
}
}
图 1
解决方案
自本教程制作以来,库中发生了重大变化。与教程相同,
将包版本恢复为,即可解决问题。1.0.0-alpha06
推荐阅读
- python - Python Django-Rest-Framework 更新用户数据创建
- javascript - 如何使用 rxjs 处理 http 并发请求和速率限制
- android - 反应原生安卓
- spring - SAP Hybris 将 Doctype 添加到 cXML Punchout
- python - 将多个 Y 轴与 Plotly 中的一个值对齐
- excel - 如何通过选择日期范围将 Outlook 电子邮件详细信息导出到 Excel?
- python - 运行 python 脚本在输出位置获取执行 ID
- docusignapi - Docusign:使用 docusign.esign.dll 5.0.0 时的 PARTNER_AUTHENTICATION_FAILED
- c# - TcpClient C# 等待新数据可用
- angular - 无法将 Angular 应用程序作为 docker 容器运行。没有这样的文件错误