Skip to content

Conversation

@Jmilham21
Copy link
Collaborator

Pull Request Description

What does this Pull Request do?

Fixes Android build failures for non-IMA users by making the jwplayer-ima dependency truly optional through Gradle source sets.

  • Splits IMA code into separate source sets (src/ima/ and src/noima/)
  • Adds warnings when IMA is configured but not enabled
  • Supports both "client" and "adClient" property names
  • Player loads gracefully without ads instead of crashing

Why is this Pull Request needed?

After v1.3.0, developers not using IMA ads couldn't build their apps because:

  • jwplayer-ima was always included (requires desugaring)
  • IMA classes were unconditionally referenced in code

This makes IMA truly optional - no IMA dependencies or desugaring required unless explicitly enabled.

Are there any points in the code the reviewer needs to double check?

  1. Source sets in android/build.gradle - verify paths are correct
  2. Both ImaHelper implementations have identical signatures
  3. Two config paths in RNJWPlayerView.java:
    • JSON parser: warning only
    • Legacy builder: warning + skip advertising setup
  4. Chromecast remains always included (separate issue for future)

Are there any Pull Requests open in other repos which need to be merged with this?

No


Addresses Issue(s):

GitHub Issue #201

- Added IMA-specific advertising configuration helper in `ImaHelper.java` for managing IMA and IMA DAI ads.
- Updated `RNJWPlayerAds.java` to delegate IMA configuration to `ImaHelper`.
- Introduced validation in `RNJWPlayerView.java` to ensure IMA settings are not used when IMA is disabled.
- Enhanced `build.gradle` to conditionally include IMA dependencies based on configuration.
- Improved validation for 'adClient' in `RNJWPlayerAds.java` to ensure it is present and not null.
- Added checks for 'assetKey' and video identifiers in `ImaHelper.java` to enforce correct IMA DAI settings.
- Updated ad schedule handling to return an empty list if not provided, preventing null pointer exceptions.
- Enhanced error messages for better clarity on configuration issues.
- Enhanced `ImaHelper.java` to support both "adClient" and "client" keys for IMA configuration.
- Updated `RNJWPlayerAds.java` to handle legacy "googima" format and added error logging for IMA configuration failures.
- Introduced new methods in `RNJWPlayerView.java` to check and warn about IMA usage when IMA is disabled, improving user feedback.
- Refactored advertising configuration logic to conditionally skip IMA setup based on the presence of relevant keys.
@Jmilham21 Jmilham21 requested a review from a team as a code owner December 30, 2025 22:42
@Jmilham21 Jmilham21 changed the title Jmilham21/issue201 Fix Android build failure for non-IMA users (#201) Dec 30, 2025
@Jmilham21
Copy link
Collaborator Author

Solves the build problem, and all IMA configs still work when IMA is enabled.

@Jmilham21 Jmilham21 merged commit c5681bb into master Dec 30, 2025
@Jmilham21 Jmilham21 deleted the Jmilham21/issue201 branch December 30, 2025 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants