CameraX 未正确配置。最可能的原因是您没有在构建中包含默认实现,例如 'camera-camera2
CameraX is not configured properly. The most likely cause is you did not include a default implementation in your build such as 'camera-camera2
从 androidx.camera:camera-view:1.0.0-alpha32
更新到 androidx.camera:camera-view:1.1.0-beta01
后,我在使用 CameraX
时收到下一个错误
camerax_version = "1.0.2"
// CameraX
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:1.1.0-beta01"
错误
java.lang.IllegalStateException: CameraX is not configured properly. The most likely cause is you did not include a default implementation in your build such as 'camera-camera2'.
at androidx.camera.core.CameraX.<init>(CameraX.java:109)
at androidx.camera.lifecycle.ProcessCameraProvider.getOrCreateCameraXInstance(ProcessCameraProvider.java:181)
at androidx.camera.lifecycle.ProcessCameraProvider.getInstance(ProcessCameraProvider.java:167)
它失败了,因为你对各种 androidx.camera.* 库有不同的版本。
如果你检查这个:
https://developer.android.com/jetpack/androidx/releases/camera
它有以下描述:
From 1.1.0-beta01, all CameraX libraries will align the same version
number. This will help developers track versions much easier and
reduce the complexity of large version compatibility matrix.
因此您需要为所有 camerax 库使用相同的版本。
从 androidx.camera:camera-view:1.0.0-alpha32
更新到 androidx.camera:camera-view:1.1.0-beta01
后,我在使用 CameraX
camerax_version = "1.0.2"
// CameraX
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:1.1.0-beta01"
错误
java.lang.IllegalStateException: CameraX is not configured properly. The most likely cause is you did not include a default implementation in your build such as 'camera-camera2'.
at androidx.camera.core.CameraX.<init>(CameraX.java:109)
at androidx.camera.lifecycle.ProcessCameraProvider.getOrCreateCameraXInstance(ProcessCameraProvider.java:181)
at androidx.camera.lifecycle.ProcessCameraProvider.getInstance(ProcessCameraProvider.java:167)
它失败了,因为你对各种 androidx.camera.* 库有不同的版本。
如果你检查这个:
https://developer.android.com/jetpack/androidx/releases/camera
它有以下描述:
From 1.1.0-beta01, all CameraX libraries will align the same version number. This will help developers track versions much easier and reduce the complexity of large version compatibility matrix.
因此您需要为所有 camerax 库使用相同的版本。