Camerax样本:未解决的参考:WindowManager

发布于 2025-01-21 12:48:43 字数 82 浏览 0 评论 0原文

我正在尝试编译示例CameraxBasic,但我会收到此错误: 未解决的参考:WindowManager 我检查了Gradle文件,并且有这种依赖性。

I'm trying to compile the sample cameraxbasic but I get this error:
Unresolved reference: WindowManager
I checked gradle files and there is that dependency.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心意如水 2025-01-28 12:48:43

我在 https://developer..android.com/jetroid.com/jetpack/androidx/-发布/窗口并通过以下这些更改调整了样本以使其正常工作。希望这有帮助!

  1. 使用实现“ Androidx.Window:窗口:1.1.0-Alpha01”
  2. 替换Windowsmanager window> window> window> window> window ininfotracker
  3. 替换window> window> window> window manager(context)代码>带有windowInfotracker.getOrcreate(view.context)
  4. 替换window> window> windowscurrentwindowmetrics()。bunds at witch> window> windowsmetricscalculator.getOrcreate.getOrcreate()。边界

I reviewed the library change log at https://developer.android.com/jetpack/androidx/releases/window and adjusted the sample with following these changes to make it work. Hope this helps!

  1. use implementation "androidx.window:window:1.1.0-alpha01"
  2. replace WindowManager with WindowInfoTracker
  3. replace WindowManager(context) with WindowInfoTracker.getOrCreate(view.context)
  4. replace windowManager.getCurrentWindowMetrics().bounds with WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(requireActivity()).bounds
赏烟花じ飞满天 2025-01-28 12:48:43

funny how Microsoft has a guide on Window Manager here:

https://learn.microsoft.com/en-us/dual-screen/android/jetpack/window-manager/?tabs=views

guide says which packages to include and how to use in the code, specifically to answer the question:

windowInfoTracker = WindowInfoTracker.getOrCreate(this@MainActivity)

while android has no official guide and a broken use case at the official github CameraX sample

funny how Microsoft has a guide on Window Manager here:

https://learn.microsoft.com/en-us/dual-screen/android/jetpack/window-manager/?tabs=views

guide says which packages to include and how to use in the code, specifically to answer the question:

windowInfoTracker = WindowInfoTracker.getOrCreate(this@MainActivity)

while android has no official guide and a broken use case at the official github CameraX sample https://github.com/android/camera-samples/tree/master/CameraXBasic

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文