gpt4 book ai didi

android - 为什么当我删除 @SuppressLint "only be called from with the same library group"时 Android Studio 会显示 ("RestrictedApi")?

转载 作者:行者123 更新时间:2023-12-04 05:44:11 25 4
gpt4 key购买 nike

代码A来自CameraX项目,你可以看到source code .

当我删除 @SuppressLint("RestrictedApi") 时,Android Studio 将显示“只能从同一个库组中调用” ,您可以看到图 1。

为什么我不能删除 @SuppressLint("RestrictedApi")在代码 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

enter image description here

最佳答案

自本教程制作以来,库中发生了重大变化。
将软件包版本恢复为 1.0.0-alpha06 ,和教程一样,解决了问题。

关于android - 为什么当我删除 @SuppressLint "only be called from with the same library group"时 Android Studio 会显示 ("RestrictedApi")?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58567716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com