mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Auto-Value Runtime Dependency on Android

Open befrvnk opened this issue 8 months ago • 4 comments

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

None

OS Platform and Distribution

Android

Mobile device if the issue happens on mobile device

No response

Browser and version if the issue happens on browser

No response

Programming Language and version

Java, Kotlin

MediaPipe version

0.10.21

Bazel version

No response

Solution

Pose landmark detection

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

No response

Xcode & Tulsi version (if issue is related to building for iOS)

No response

Describe the actual behavior

MediaPipe relies on auto-value as a runtime dependency, but this is unnecessary and can be omitted.

Describe the expected behaviour

MediaPipe does not require Auto-Value as a runtime dependency.

Standalone code/steps you may have used to try to get what you need

This a problem with all Android builds of tasks-vision.

Other info / Complete Logs

Only tested it with `com.google.mediapipe:tasks-vision:0.10.21` so far.

befrvnk avatar Mar 26 '25 08:03 befrvnk

Hi @befrvnk,

Could you please provide more details about the issue you are encountering? If you are receiving any errors or require specific support from our side, kindly share the complete information so we can better understand the situation.

Thank you!!

kuaashish avatar Mar 26 '25 08:03 kuaashish

@kuaashish The published pom for tasks-vision (for example https://maven.google.com/com/google/mediapipe/tasks-vision/0.10.21/tasks-vision-0.10.21.pom) contains

    <dependency>
      <groupId>com.google.auto.value</groupId>
      <artifactId>auto-value</artifactId>
      <version>1.8.1</version>
      <scope>compile</scope>
    </dependency>

This means that when we depend on tasks-vision we will also transitively depend on auto-value. This particular artifact is just the auto value annotation processor, so it's only needed an build time when annotation processing is running, but there is no need for it at runtime. So it would be great if it would not be listed as a dependency in pom or with a scope that does not add it to the consumer's dependencies.

There are 2 consequences of having this dependency:

  • increases app sizes unneccesarily
  • causes R8 warnings/errors because auto-value references classes not available in the Android SDK which forces us to add the following to our proguard/r8 config
    -dontwarn javax.lang.model.SourceVersion
    -dontwarn javax.lang.model.element.Element
    -dontwarn javax.lang.model.type.TypeMirror
    -dontwarn javax.lang.model.type.TypeVisitor
    -dontwarn javax.lang.model.util.SimpleTypeVisitor8
    
    (this was also mentioned here https://github.com/google-ai-edge/mediapipe/issues/5859)

gabrielittner avatar Mar 26 '25 09:03 gabrielittner

Hi @whhone,

Could you please look into this issue?

Thank you!!

kuaashish avatar Mar 26 '25 09:03 kuaashish

Thanks for reporting. We will fix it in the next release.

whhone avatar Mar 26 '25 15:03 whhone