Skip to content

feat(audience): resolve install referrer via Maven instead of bundling the AAR#794

Merged
nattb8 merged 2 commits into
mainfrom
feat/audience-installreferrer-maven
Jun 16, 2026
Merged

feat(audience): resolve install referrer via Maven instead of bundling the AAR#794
nattb8 merged 2 commits into
mainfrom
feat/audience-installreferrer-maven

Conversation

@nattb8

@nattb8 nattb8 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

The Audience package bundled installreferrer-2.2.aar directly, and bundled AARs can't be de-duplicated by Gradle — so any game that already pulled the Google Play Install Referrer Library via another SDK hit class/version conflicts on the Android build. This swaps the bundled AAR for a Maven-resolved dependency so Gradle resolves a single highest version across all SDKs, fixing the conflict reported from customer.

Changes

  • Remove the bundled installreferrer-2.2.aar (+ .meta).
  • Add Editor/ImmutableAudienceDependencies.xml declaring com.android.installreferrer:installreferrer:2.2 for EDM4U's Android Resolver.
  • Document a manual mainTemplate.gradle line so EDM4U is a recommended prerequisite, not a hard requirement.
  • Add that same manual line to the examples/audience sample (it doesn't use EDM4U), which also serves as a worked example of the fallback.
  • Retain the defensive R8 keep-rules in proguard-user.txt (the Maven artifact is the same AAR).

Notes

  • play-services-ads-identifier (GAID) is intentionally still studio-provided, so games not collecting the advertising ID never declare AD_ID. Unchanged.
  • The AUDIENCE_MOBILE_ATTRIBUTION define still gates the C# JNI code. The Maven dependency itself is no longer define-gated (EDM4U can't read scripting defines), so non-attribution builds carry a ~8 KB permissionless unused dependency — an accepted cosmetic cost over a Unity-version-fragile Gradle-injection post-processor.

⚠️ Breaking change

Studios using AUDIENCE_MOBILE_ATTRIBUTION now need either EDM4U (automatic) or the documented manual Gradle line. The package is alpha, so this is acceptable.

Testing

Verified with a batchmode Android build of examples/audience (Unity 2021.3.45f2, AUDIENCE_MOBILE_ATTRIBUTION set, manual-fallback gradle path — no EDM4U):

  • Package imports and compiles cleanly with the AAR removed; the new Dependencies.xml/.meta import without error.
  • Gradle resolved installreferrer:2.2 from Maven (confirmed in the manifest-merger report).
  • The resulting App Bundle's dex contains the installreferrer classes (InstallReferrerClient, InstallReferrerClientImpl, ReferrerDetails, …).
  • Build succeeded.

The EDM4U auto-resolution path (Dependencies.xml) was not exercised — this sample project has no EDM4U installed — so a reviewer with an EDM4U project should sanity-check that path.

@nattb8 nattb8 requested review from a team as code owners June 15, 2026 23:07
@nattb8 nattb8 force-pushed the feat/audience-installreferrer-maven branch from d8d4d0b to 4ecca14 Compare June 15, 2026 23:24
nattb8 and others added 2 commits June 16, 2026 11:25
…g the AAR

Bundled AARs can't be de-duplicated by Gradle, so shipping
installreferrer-2.2.aar directly caused class/version conflicts when a
game pulled the same library in via another SDK. Declare it as a Maven
dependency through EDM4U (Editor/ImmutableAudienceDependencies.xml) and
document a manual mainTemplate.gradle fallback for projects without EDM4U.
The AUDIENCE_MOBILE_ATTRIBUTION define still gates the C# JNI code; the
defensive proguard keep-rules are retained.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… template

The sample no longer gets the Install Referrer Library from a bundled
AAR, and it doesn't use EDM4U, so it declares the Maven dependency
manually in mainTemplate.gradle - the documented fallback path. Verified
the resulting App Bundle includes the installreferrer classes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nattb8 nattb8 force-pushed the feat/audience-installreferrer-maven branch from 4ecca14 to 13e40ba Compare June 15, 2026 23:26
@nattb8 nattb8 merged commit 6a3eba5 into main Jun 16, 2026
63 of 72 checks passed
@nattb8 nattb8 deleted the feat/audience-installreferrer-maven branch June 16, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants