2020-05-12 22:21:32.300 27492-27492/com.example.smith.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.smith.app, PID: 27492
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/internal/client/zzc;
at com.google.android.gms.vision.face.FaceDetector$Builder.build(Unknown Source)
at com.example.smith.swipe.SelectProfilePic$3.onClick(SelectProfilePic.java:123)
我想检测上传的图片中是否有脸。
FaceDetector faceDetector = new FaceDetector.Builder(getApplicationContext())
.setTrackingEnabled(false)
.setLandmarkType(FaceDetector.ALL_LANDMARKS)
.setMode(FaceDetector.FAST_MODE)
.build();
当我在一个新的项目上试了一下,它完美无瑕。
我在两个项目上使用的版本。
implementation 'com.google.android.gms:play-services-vision:11.8.0'
把这个放在Manifest中 <application>
标签。
<uses-library android:name="org.apache.http.legacy" android:required="false"/>