MediaMetadataRetriver.setDataSource crash in release while trying to load resource (status = 0x80000000)

0

I'm trying to read metadata from a resource using MediaMetadataRetriver, it works in debug variant, but crash in release variant.

java.lang.RuntimeException: setDataSource failed: status = 0x80000000

what should it do??

android
gradle
mediametadataretriever
asked on Stack Overflow Apr 8, 2020 by Roi Amiel

1 Answer

0

In case your Gradle is configured to shrink resources in the release variant (shrinkResources true), you probably will not be able to read the resource metadata (the shrink algorithm could destroy the resource metadata).

there are 2 possible solutions:

  1. Tell android shrinker, to ignore certain resources (see: https://stackoverflow.com/a/45435370/5151590).
  2. Move your resource to the assets folder (it will be safe from evil shrinkers).
answered on Stack Overflow Apr 8, 2020 by Roi Amiel

User contributions licensed under CC BY-SA 3.0