Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**
// Google Play Install Referrer Library, resolved from Maven (the Audience
// package no longer bundles it as an .aar - it conflicted with other SDKs).
// EDM4U projects get it automatically from ImmutableAudienceDependencies.xml;
// this sample has no EDM4U, so it declares the dependency manually.
implementation 'com.android.installreferrer:installreferrer:2.2'

// Uncomment to enable GAID collection (requires AUDIENCE_MOBILE_ATTRIBUTION
// scripting define + AudienceConfig.EnableMobileAttribution). Without this
// line the SDK still builds and runs, but `gaid` / `gaidLimitAdTracking`
Expand Down
25 changes: 25 additions & 0 deletions src/Packages/Audience/Editor/ImmutableAudienceDependencies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
EDM4U dependency declaration. The Google Play Install Referrer Library is
resolved from Maven rather than bundled as an .aar: bundled .aars can't be
de-duplicated by Gradle, so shipping installreferrer-2.2.aar directly caused
class/version conflicts with other SDKs. Declaring it here lets Gradle pick a
single highest version.

Requires EDM4U. Without it, add the dependency manually to
Assets/Plugins/Android/mainTemplate.gradle:
implementation 'com.android.installreferrer:installreferrer:2.2'

play-services-ads-identifier (GAID) is intentionally NOT declared here - left
to the studio, so games that don't collect the advertising ID never declare
the AD_ID permission (see AndroidManifestPostProcessor).
-->
<dependencies>
<androidPackages>
<androidPackage spec="com.android.installreferrer:installreferrer:2.2">
<repositories>
<repository>https://maven.google.com</repository>
</repositories>
</androidPackage>
</androidPackages>
</dependencies>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions src/Packages/Audience/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,29 @@ Press Play; `ImmutableAudience.Initialized` returns `true` and `AnonymousId` bec
- Integration guide and API reference: <https://docs.immutable.com/docs/products/audience/unity-sdk>
- Sample Unity project: [`examples/audience`](https://github.com/immutable/unity-immutable-sdk/tree/main/examples/audience)

## Vendored dependencies
## Android dependencies

The package vendors prebuilt third-party AARs for mobile attribution. They are only included in your build when the corresponding scripting define is set; without the define they're stripped via `defineConstraints` on the plugin meta files.
Mobile install attribution (the `AUDIENCE_MOBILE_ATTRIBUTION` define) needs the Google Play Install Referrer Library. The package does **not** bundle it as a prebuilt `.aar` — bundled AARs can't be de-duplicated by Gradle, so shipping `installreferrer-2.2.aar` directly caused class/version conflicts when a game already pulled in the same library via another SDK. Instead it's resolved from Maven:

| File | Version | Source | Required define |
| --- | --- | --- | --- |
| `Runtime/Plugins/Android/installreferrer-2.2.aar` | 2.2 | [maven.google.com](https://maven.google.com/web/index.html#com.android.installreferrer:installreferrer:2.2) | `AUDIENCE_MOBILE_ATTRIBUTION` |
| Dependency | Version | Source |
| --- | --- | --- |
| `com.android.installreferrer:installreferrer` | 2.2 | [maven.google.com](https://maven.google.com/web/index.html#com.android.installreferrer:installreferrer:2.2) |

`Runtime/Plugins/Android/proguard-user.txt` ships explicit R8 keep rules for the Install Referrer Library. Unity's gradle build merges it automatically when the AAR is included.
**With [EDM4U](https://github.com/googlesamples/unity-jar-resolver) (recommended):** no action needed. `Editor/ImmutableAudienceDependencies.xml` declares the dependency and EDM4U's Android Resolver fetches it, resolving any version conflict with other SDKs to a single highest version. Install EDM4U as a project prerequisite — do not embed a second copy.

Before tagging a release, check `maven.google.com` for newer versions of any vendored dependency and bump the pinned filename if needed.
**Without EDM4U:** add the dependency to your `Assets/Plugins/Android/mainTemplate.gradle`:

```gradle
dependencies {
implementation 'com.android.installreferrer:installreferrer:2.2'
}
```

`Runtime/Plugins/Android/proguard-user.txt` ships explicit R8 keep rules for the Install Referrer Library; Unity's gradle build merges them regardless of how the dependency is resolved.

`play-services-ads-identifier` (GAID) is intentionally left for the studio to add, so games that don't collect the advertising ID never declare the `AD_ID` permission.

Before tagging a release, check `maven.google.com` for a newer version and bump the pinned version above and in `ImmutableAudienceDependencies.xml` if needed.

## License

Expand Down
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Keep Google Play Install Referrer Library symbols.
#
# The AAR (installreferrer-2.2.aar) ships consumer rules in
# The installreferrer AAR (resolved from Maven via EDM4U or a manual gradle
# dependency - see README) ships consumer rules in
# META-INF/com.android.tools/proguard/proguard.txt and Unity's gradle build
# auto-merges them, but R8 fullMode in Unity 2022.3+ has been observed to
# discard merged consumer rules in some studio configurations. These
Expand Down
Loading