androidx / androidx/media

`media3-migration.sh` incorrectly rewrites `MetadataRenderer` import (and others)

Open
#2,960 11 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Dec 29, 2025.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 main branch

More version details

This actually occurs with any ExoPlayer client code running the 2.19.1 version of the migration script, but there is no place to put the bug there.

Devices that reproduce the issue

n/a

Devices that do not reproduce the issue

n/a

Reproducible in the demo app?

Yes

Reproduction steps

Run the media3-migration.sh script on any file that imports any of the affected classes

Summary

media3-migration.sh expands CLASS_MAPPINGS into sed substitutions that are not anchored (they match substrings, not whole identifiers). This causes prefix collisions when one class name is a prefix of another.

Concrete example: the mapping intended to rewrite only:

  • com.google.android.exoplayer2.metadata.Metadata

also matches the prefix of:

  • com.google.android.exoplayer2.metadata.MetadataRenderer

As a result, code importing MetadataRenderer can be rewritten to the wrong package, and the correct mapping never gets a chance to apply.


Affected script / location

  • Script: media3-migration.sh

  • Repo: google/ExoPlayer (release-v2 branch)

  • Relevant code in the script (class mapping expression builder):

    classes_expressions+="-e s/$src\.$clazz/$dest.$clazz/g "
    
    
Expected result

Correct mappings are applied to all former ExoPlayer classes. Example,

import com.google.android.exoplayer2.metadata.MetadataRenderer;
Actual result

Package is incorrectly mapping the class to common:

import androidx.media3.common.MetadataRenderer;
Media

n/a

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.