react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 CameraX is not configured properly. The most likely cause is you did not include a default implementation in your build such as ‘camera-camera2’

Open anisurrahman072 opened this issue 1 year ago • 5 comments

What were you trying to do?

I just wanted to use react-native-vision-camera to capture picture.

Reproduceable Code

Try bellow things to reproduce this issue

I am using React native bellow version:
"react-native": "0.67.0"


My android/build.gradle file's ext is bellow:
ext {
	buildToolsVersion = "31.0.0"
	minSdkVersion = 21
	compileSdkVersion = 31
        targetSdkVersion = 31
	googlePlayServicesVersion = '16.+'
        ndkVersion = "20.1.5948944"
}

My gradle version:
classpath("com.android.tools.build:gradle:7.0.0")

My gradle-wrapper.properties using this:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

What happened instead?

As CameraX is showing me it is not configured properly, so i think for this reason i get undefined from the bellow code:

const devices = useCameraDevices()
const device = devices.back
console.log(device)

I am getting undefined in terminal from abover console.log()

Relevant log output

From Logcat:
E/CameraX: Failed to retrieve default CameraXConfig.Provider from meta-data
    android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.basementsports/androidx.camera.core.impl.MetadataHolderService}
        at android.app.ApplicationPackageManager.getServiceInfo(ApplicationPackageManager.java:578)
        at androidx.camera.core.CameraX.getConfigProvider(CameraX.java:166)
        at androidx.camera.core.CameraX.<init>(CameraX.java:106)
        at androidx.camera.lifecycle.ProcessCameraProvider.getOrCreateCameraXInstance(ProcessCameraProvider.java:181)
        at androidx.camera.lifecycle.ProcessCameraProvider.getInstance(ProcessCameraProvider.java:167)
        at com.mrousavy.camera.CameraViewModule$getAvailableCameraDevices$1.invokeSuspend(CameraViewModule.kt:145)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Device

Realme 8 (Android-12)

VisionCamera Version

^2.13.5

Additional information

anisurrahman072 avatar Jul 20 '22 10:07 anisurrahman072

is this happening only in android ? I have same issue but ios works well. But android gives me this error

kaiyes avatar Jul 20 '22 14:07 kaiyes

In my case, when I try to clean build cache, I get this error. Which leads me to think this might be something to do with either:

  • kotlin-android-extensions' Gradle plugin being deprecated Or
  • Frame processor is active ( I don't need it for now )

I will test let you know if disabling frame processors this resolves for me

Screen Shot 2022-07-20 at 8 42 30 PM

kaiyes avatar Jul 20 '22 14:07 kaiyes

This seems to have sorted it for this dev. Almost identical to our issue

https://github.com/mrousavy/react-native-vision-camera/issues/952#issuecomment-1092700775

kaiyes avatar Jul 20 '22 14:07 kaiyes

Tried the above mentioned solution ( disable frame processors ). Problem still exists

kaiyes avatar Jul 21 '22 02:07 kaiyes

Added the latest version of vision camera but problem still exists. Weird because this commit adds a beta AndroidX camera https://github.com/mrousavy/react-native-vision-camera/commit/a7d620cf2261147de5aa9cf1de1d45c3a226077d

Thought it would have solved it.

kaiyes avatar Jul 21 '22 04:07 kaiyes

Closing as this is a stale issue - this might have been fixed with the full rewrite in VisionCamera V3 (🥳) - if not, please create a new issue.

mrousavy avatar Sep 30 '23 09:09 mrousavy