Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

camerax sample: Unresolved reference: WindowManager

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.

like image 697
Marco Piccirilli Avatar asked Jul 13 '26 13:07

Marco Piccirilli


1 Answers

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
like image 186
AdamVe Avatar answered Jul 20 '26 19:07

AdamVe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!