0

I am new to Mediapipe, I am currently working on an Android application in which I am brought to perform both real-time face detection and hand tracking. Now integrating each calculator separately by adding the Mediapipe AAR into the libs directory of android studio works just fine, but when I try to add both AARs of "Hand tracking" and "Face detection " to run them together simultaneously I have some kind of dependency conflicts and class duplication issues, am I doing something wrong if yes how could I integrate two Mediapipe models in one Android project ?? please any help would be very appreciated. I have this errors below:

Duplicate class com.google.mediapipe.components.AudioDataConsumer found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.AudioDataProcessor found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.AudioDataProducer found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.CameraHelper found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.CameraHelper$CameraFacing found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.CameraHelper$OnCameraStartedListener found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.CameraXPreviewHelper found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.CameraXPreviewHelper$SingleThreadHandlerExecutor found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.ExternalTextureConverter found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.ExternalTextureConverter$RenderThread found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.ExternalTextureConverter$RenderThread$PoolTextureFrame found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.FrameProcessor found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.FrameProcessor$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.FrameProcessor$2 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.FrameProcessor$ErrorListener found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.FrameProcessor$OnWillAddFrameListener found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.MicrophoneHelper found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.PermissionHelper found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.TextureFrameConsumer found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.TextureFrameProcessor found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.components.TextureFrameProducer found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$Rasterization found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$Rasterization$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$Rasterization$Interval found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$Rasterization$Interval$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$Rasterization$IntervalOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.annotation.proto.RasterizationProto$RasterizationOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$Detection found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$Detection$AssociatedDetection found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$Detection$AssociatedDetection$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$Detection$AssociatedDetectionOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$Detection$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$DetectionList found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$DetectionList$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$DetectionListOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.DetectionProto$DetectionOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$Landmark found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$Landmark$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$LandmarkList found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$LandmarkList$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$LandmarkListOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$LandmarkOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmark found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmark$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmarkList found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmarkList$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmarkListOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LandmarkProto$NormalizedLandmarkOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BinaryMask found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BinaryMask$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BinaryMaskOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BoundingBox found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BoundingBox$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$BoundingBoxOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$Format found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$Format$1 found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$Format$FormatVerifier found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$RelativeBoundingBox found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$RelativeBoundingBox$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$RelativeBoundingBoxOrBuilder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) Duplicate class com.google.mediapipe.formats.proto.LocationDataProto$LocationData$RelativeKeypoint found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and mp_multi_hand_aar-runtime.jar (mp_multi_hand_aar.aar) ... ... com.google.mediapipe.formats.proto.LocationDataProto$LocationData$RelativeKeypoint$Builder found in modules mediapipe_face_detection-runtime.jar (mediapipe_face_detection.aar) and Go to the documentation to learn how to Fix dependency resolution errors.

  • This might due to caching problems, it said `Duplicate class...` have you already try invalidate & restart as usual? – mochadwi Jul 09 '21 at 15:02
  • @mochadwi could you please elaborate, what do you mean invalidate ? – Moufdi T'aha Jul 09 '21 at 15:45
  • You can read more at: https://www.jetbrains.com/help/idea/invalidate-caches.html. In Android Studio we can access the menu on `File -> Invalidate Caches` afaik – mochadwi Jul 09 '21 at 15:47
  • I tried it, it changed nothing ! the class duplication problem is due to the fact that the two hand tracking and face detection Mediapipe AAR use common classes,If I delete one of them there's no more this problem, however I need them running together, so I don't have much of a choice !! I don't what to do ! – Moufdi T'aha Jul 09 '21 at 16:07
  • have you already try to analyze the transitive dependencies? `./gradlew ::dependencies > deps.txt`. Check if there's a conflicted transitive dependencies. For the conflicted dependencies try to exclude either `two hand tracking` or `face detection Mediapipe` AAR transitive dependencies from your project, with `exclude(...)`, or see here for details: https://docs.gradle.org/current/userguide/dependency_downgrade_and_exclude.html#sec:excluding-transitive-deps – mochadwi Jul 09 '21 at 16:16
  • thank you for your hints. I've been looking how to exclude a jar file from inside an AAR but I did not find an answer, do you by any chance know how to do it please ? – Moufdi T'aha Jul 09 '21 at 18:24
  • looks like the local `AAR` is not possible to exclude its transitive dependencies (or .jar) inside it: https://stackoverflow.com/a/36931247/3763032 – mochadwi Jul 10 '21 at 14:57
  • did you happen to understand how to publish to **maven local**? You might need to publish locally first to fetch the transitive dependencies in that AAR. Also there's a `fat-aar` approach discussed in here: https://stackoverflow.com/questions/36916991/transitive-dependencies-for-local-aar-library?noredirect=1&lq=1#comment95401633_36931247 – mochadwi Jul 10 '21 at 15:07
  • I'm curious if it possible for your to fetch the **_two hand tracking_** and **_face detection Mediapipe_** from a private maven repository instead of using `.aar`? – mochadwi Jul 10 '21 at 15:08
  • I think it's not possible ! I believe the only approach mentioned in the Mediapipe official guide is using the .aar ! – Moufdi T'aha Jul 12 '21 at 08:29
  • Honestly, I don't know what that means ! – Moufdi T'aha Jul 16 '21 at 08:14

0 Answers0