Play Asset Delivery: SecurityException on Android 14

Using Unity 2021.3.28f1 the com.unity3d.player.PlayAssetDeliveryUnityWrapper.registerDownloadStatusListener module is throwing “SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn’t being registered exclusively for system broadcasts” on Android 14 when targeting Android API 34." Attached is a stack trace. Is this fixed in a newer 2021 release and/or is a fix in the works? All that is required is to add of the parameters such as:

“Intent intent = _activity.registerReceiver(BluetoothReceiver, filter, android.content.Context.RECEIVER_NOT_EXPORTED);”

9419582–1320155–strace.txt (3.24 KB)

Issue is coming from
‘com.google.android.play:asset-delivery:2.0.0’ package. As a workaround you can try exporting your project, modify build.gradle
(changing from
implementation ‘com.google.android.play:asset-delivery:2.0.0’
to
implementation ‘com.google.android.play:asset-delivery:2.1.0’)
and building from Android Studio.
Or another option - enable Custom Main Gradle template in Player → Publishing settings and add
implementation ‘com.google.android.play:asset-delivery:2.1.0’ to the dependencies section

@IGuscin thank you for the suggestion. Unfortunately, changing to version 2.1.0 results in an immediate crash on startup. I’ve attached the crash stack trace

9432989–1322693–a14-crash.txt (328 KB)

Hi all,

Any update on this ?

Fab

We’re getting the same problem with the latest 2020.3 release when building an android AAB bundle with “split application binary” enabled (to generate embedded asset packs).
As stated before, the solution provided here doesn’t work for multiple reasons:

  • the “com.google.android.play:asset-delivery” library is not in the dependencies of the build.gradle file in Unity 2020 or 2021, instead the older “com.google.android.play:core” is. And you can’t just replace one with the other without also altering the native android player code…
    This essentially replaces a problem with another.
  • the exception is clearly thrown from native android player code not meeting the API requirements. Unless the newer versions of this API reverted those requirements, the provided solution has no chance to work.

As of now, building an Android AAB app targetting Android 14 (API 34) using Unity 2020 or 2021 is impossible if you also want to use embedded asset packs by enabling the “split application binary” option.

Hello all,
Any updates?

As far as I can see the fix has already landed and should be available in 2021.3.34f1 and 2022.3.14f1

2 Likes

The most recent version of 2021 that I see is Unity 2021.3.33f1. This version still has the crash issue.

I’m not sure what’s the release timeframe, but the fix has landed and should be in 2021.3.34f1

1 Like

When will 2021.3.34f1 arrive?

1 Like

Still persists in 2021.3.34f1 - working on Android 13 but not on 14. Any suggestions?
Working with 2022.3.17f1 on Android 14!

Can you share a repro project? It might be another issue (same issue, caused by different lib, package etc.)

My case with crash:

  1. Unity 2021.3.34
  2. Build with options:
    2.1. Build App Bundle
    2.2. minimum api 22
    2.3. target api 33 or 34
  3. Upload app to google console(because build *.aab)
  4. Donwload and start app on Android 14
  5. Crash

9631070–1368320–crash.txt (4.38 KB)

I cannot say anything without an repro project. We’re unable to reproduce the issue. Only a wild guess - did you enable split app binary?

Ok I made sample project: https://drive.google.com/file/d/11uNFiTrhFTU2qz1nPVmBSIu_R4A2HmWm/view?usp=sharing
Also i made build: https://drive.google.com/file/d/1coJeJjdaEThrdeOwn34xxbsl251Vtk7Q/view?usp=sharing

For build use menu: MVP → 1) Build App
For install use menu: MVP → 2) Install build
For change build params use script BuildTool.cs

I’d like to jump in here and ask should the fix also work for split binary then? We’re under the same belief as HarryCoder explained earlier here: Play Asset Delivery: SecurityException on Android 14

As far as I know 2020.3 is no longer supported, so I wouldn’t expect fix to land there. For 2021.3 - fix was actually targeting this specific case. Crash was occurring in Google ‘com.google.android.play:asset-delivery:2.0.0’ package, so the fix was to bump package version in 2022.3 and above Unity versions and to replace obsolete com.google.android.play:core package in 2021.3

2 Likes

Maybe I’m missing something? I’ve downloaded your sample project, opened using Unity 2021.3.35f1, specified signing key, built using MVP->Build, uploaded to the Play Store Internal testing track, downloaded to the Pixel 6 Pro Android 14 device. No crash occurred. Seeing empty scene with Build ID in the bottom

I did sample for 2021.3.34f1, idk, may be it’s required…
Also google store isn’t required, I can reproduce crash just use adb or bundletool commands for instal apk or aab to my device.
May be need specific device OS, my device is oneplus 10 pro, OS - OxygenOS 14.0

I believe I might know where’s the problem. As far as I can see you’ve added to the Main Gradle Template

configurations.all {
exclude group:"com.google.android.play", module: "core"
}

And your app crash with exception: java.lang.NoSuchMethodError: No interface method getPackStates(Ljava/util/List;)Lcom/google/android/play/core/tasks/Task;