googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.6k stars 2.94k forks source link

[Bug report] Attempt to invoke virtual method 'com.google.mlkit.vision.face.internal.FaceDetectorImpl com.google.mlkit.vision.face.internal.zzc.zzb(com.google.mlkit.vision.face.FaceDetectorOptions)' on a null object reference #888

Open Bui-Ly opened 4 weeks ago

Bui-Ly commented 4 weeks ago

Describe the bug this my code:


MlKitContext.initializeIfNeeded(this); // 

FaceDetectorOptions realTimeOpts =
                new FaceDetectorOptions.Builder()
                        .setContourMode(FaceDetectorOptions.CONTOUR_MODE_ALL)
                        .build();

when i initialize FaceDetectorOptions i always get this error

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.mlkit.vision.face.internal.FaceDetectorImpl com.google.mlkit.vision.face.internal.zzc.zzb(com.google.mlkit.vision.face.FaceDetectorOptions)' on a null object reference at com.google.mlkit.vision.face.FaceDetection.getClient(com.google.android.gms:play-services-mlkit-face-detection@@17.1.0:3)

SDK Info: