Facedetector Error: Cannot Resolve Method Settrackingenabled(Boolean)

Posted on

As mentioned inwards final post service “Face Detection amongst Google Play services, Mobile Vision API (with exhibit APK)“, calling setTrackingEnabled(false) method of FaceDetector object furnish fault of “Cannot resolve method setTrackingEnabled(boolean)“.

After checking reference of com.google.android.gms.vision.face.FaceDetector, setTrackingEnabled(boolean) is non a method of FaceDetector class. It’s a method of com.google.android.gms.vision.face.FaceDetector.Builder class.


public FaceDetector.Builder setTrackingEnabled (boolean trackingEnabled)
Enables or disables expression upwardly tracking, which volition keep a consistent ID for each expression upwardly when processing consecutive frames. Default: true


If your code uses a MultiProcessor or FocusingProcessor instance, tracking must live on enabled. Having tracking enabled is likewise recommended for treatment alive video.

Tracking should live on disabled for treatment a serial of non-consecutive withal images.


To ready the error, modification the code

        FaceDetector faceDetector = novel FaceDetector.Builder(getApplicationContext()).build();         faceDetector.setTrackingEnabled(false); 

to:

        FaceDetector faceDetector =                 novel FaceDetector.Builder(getApplicationContext())                 .setTrackingEnabled(false)                 .build();