We are currently unable to run builds on Android due to Unity’s built-in PAD implementation crashing the app on startup. This was purportedly fixed in Unity 2023.1.0a6, but no backporting of this fix to past LTS versions has occurred. However this may not matter as the the error has regressed in later version Unity 2023.1.6f1. This occurs for us currently on Unity 2022.3.2f1.
The issue as described here is that the PAD implementation has been only been partially updated for breaking changes in Google Play APIs and the remaining un-migrated portions are causing a crash on startup.
Configuration Unity Version: 2022.3.2f1 Platform: Android Min API Level: 26 Max API Level: 33 Scripting Backend: il2cpp API Compatibility Level: .Net Standard 2.1 Target Architecture: ARM64 Split Application Binary: Enabled Build App Bundle: Enabled Minify: Enabled for Release and Debug Plugins:
ExternalDependencyManager v1.2.175
PreciseLocale v1.5
OpenCoding Console v2.8.0
Packages:
com.yasirkula.androidruntimepermissions v1.1.6
com.yasirkula.nativecamera v1.3.7
com.yasirkula.nativegallery v1.7.2
com.ptc.vuforia.engine v10.16.3
com.unity.xr.arcore v5.0.6
com.unity.purchasing v4.9.3
Troubleshooting
Steps I’ve taken to troubleshoot are:
Add proguard stripping protections for com.google.android.gms in the off chance it was a stripping issue, but since the root cause is attempting to use an API that’s not present this likely isn’t a good solution.
Building an empty Android project on the same version of Unity with split binary and app bundle, minification (all of the same app settings) does NOT fail, but is tricky to say it’s project specific because the Unity editor/player has conditional logic based on the size of the assets at play that determines how it uses PAD at build and runtime. Attempting to beef up the size of the project via a ton of Resources folder assets and main executable linked assets so far hasn’t been successful in reproducing this error.
I’m about to start my third option at troubleshooting this to see if it’s a plugin or android config specific issue in conjunction with this bug that causes the issue by iteratively removing Android dependencies, commenting or removing that functionality from the app, and verifying the bug still occurs until only native Unity android usage is left. I’ll report back on how successful or not this is.
We ended up resolving this on one of the first plugins we removed. Though we don’t have a custom gradle file, we do have a post-build processor we needed to create to fix a duplicate AndroidX/Android Support compile issue.
The original output snippet for the gradle file looked like this:
After we modified our build processor to not exclude the com.android.gms group we were able to still retain our plugin and avoid this crash issue on startup.