Home > other >  CameraX is not configured properly. The most likely cause is you did not include a default implement
CameraX is not configured properly. The most likely cause is you did not include a default implement

Time:02-18

After updating from androidx.camera:camera-view:1.0.0-alpha32 to androidx.camera:camera-view:1.1.0-beta01 I receive the next error when using 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"

Error

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)

CodePudding user response:

It fails because you have different versions for the various androidx.camera.* libraries.

If you check this:
https://developer.android.com/jetpack/androidx/releases/camera

It has the following description:

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.

So you need to use the same version for ALL camerax libraries.

  • Related