`media3-migration.sh` incorrectly rewrites `MetadataRenderer` import (and others)
@marcbaechinger is already working on this.
Since Dec 29, 2025.
- 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 bugreportto android-media-github@google.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.