rodgomesc / vision-camera-face-detector

VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector
MIT License
95 stars 66 forks source link

Fixed: Android crash: java.lang.ClassNotFoundException: Didn't find class "com.google.mlkit.vision.common.internal.Detector" on path: DexPathList #39

Open heedoos opened 1 year ago

heedoos commented 1 year ago
React Native: 0.66.5
react-native-vision-camera: 2.15.4
vision-camera-face-detector: 0.1.8
Android API 25
Gradle 7.3

app/build.gradle
buildToolsVersion = "30.0.2"
minSdkVersion = 23
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
androidXAnnotation = "1.2.0"
androidXBrowser = "1.3.0"
kotlin_version = '1.6.0'

app/build.gradle dependencies
classpath("com.android.tools.build:gradle:7.0.0")

I found that android crashes as soon as the app started. I turned on the logcat and found these errors.

java.lang.ClassNotFoundException: Didn't find class "com.google.mlkit.vision.common.internal.Detector" on path: DexPathList java.lang.ClassNotFoundException: com.google.mlkit.vision.face.FaceDetector

Whoever has same issue, you can update "/node_modules/vision-camera-face-detection/android/build.gradle" mlkit face detection version to fix. implementation 'com.google.mlkit:face-detection:16.1.2' => implementation 'com.google.mlkit:face-detection:16.1.5'

@rodgomesc When you get a chance, can you please update this changes?

ajay2966 commented 1 year ago

I Have the Same issue when multiple face appeare in same time when app crash in android

heedoos commented 1 year ago

@ajay2966 You mean after version upgrade("com.google.mlkit:face-detection" to 16.1.5)?

ajay2966 commented 1 year ago

@heedoos vision-camera-face-detector version 0.1.8

iita71737 commented 1 year ago

Excuse me, any update ?

heedoos commented 1 year ago

You can patch using this: https://github.com/ds300/patch-package. fix the version and patch it.