Hi, I'm not able to run an exported Unity game apk on Android 12, as I get the following crash : Code (CSharp): 2021-09-11 19:40:55.335 1252-1302/? E/AndroidRuntime: FATAL EXCEPTION: pool-13-thread-1 Process: PID: 1252 java.lang.IllegalArgumentException: : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:375) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) at android.app.PendingIntent.getBroadcast(PendingIntent.java:632) at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174) at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108) at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86) at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920) Is there a fix for this issue under development? Unity editor: 2020.3.18f1
I am not sure if this is a bug in Unity. From the log it's hard to know for certain, however I don't think we create any intents in core Unity. Does your project have plugins? Is the issue reproducible if you don't use them? If you think that this is a bug in Unity, feel free to submit a bug report https://unity3d.com/unity/qa/bug-reporting
Hello, I get the same error on Android 12. I am using Unity Mobile Notifications in my Project. A User of our App has told us that they could not install the app from the Google Play Store. Right after the Download finished it just opens an Error Message saying that something went wrong. I tried using Googles Android Emulator tools and after trying to install the App on the Emulator it gave me the exact same Error.
FLAG_IMMUTABLE is a required flag when creating PendingIntent from Android 12. If you are using any of the plugins using native features (Alarms/Notifications etc which usually need Pending Intent), contact the publisher and get it fixed. If its mobile notifications package, check if there is any update for Android 12.
Found the official release notes to fix this issue if anyone happens to stumble upon this thread: https://developers.google.com/admob/android/rel-notes Basically, in unity you need to edit the mainTemplate.gradle file to include the dependencies mentioned in the above link. 1. In Unity, set the following checkbox to true to create a custom main gradle template file called mainTemplate.gradle: ProjectSettings>PlayerSettings>PublishingSettings>Build>Custom Main Gradle Template 2. In mainTemplate.gradle go to the dependencies section and change it to this: Code (CSharp): dependencies { implementation 'com.google.android.gms:play-services-ads:20.4.0' // For apps targeting Android 12, add WorkManager dependency. constraints { implementation('androidx.work:work-runtime:2.7.0') { because '''androidx.work:work-runtime:2.1.0 pulled from play-services-ads has a bug using PendingIntent without FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in Apps targeting S+.''' } } } Found this out looking through this forum here: https://groups.google.com/g/google-admob-ads-sdk/c/uCQkZcqOVtE
Dear, NOT crash on launch, issue happen when the user interacts with the game. This is the Logs I collected from those crashes: Report (Android 12 SDK 31, Device: Samsung Galaxy S21 FE) Code (CSharp): "---------------------Exception Error------------------- UnityEngine.WillRenderCanvases:Invoke() "
Please see this thread - https://forum.unity.com/threads/android-11-arm64-native-heap-allocator-issues.1047170/
You need to share complete logcat log to see what could be the issue. If its related to exported flag issue, you may need to pass me an empty apk or merged android manifest file to look into the source of the issue.
Hi there!! Im ussing the UTNotifications Plugin, and im having thiss same issue... Any hints on how to fix this? Sadly i cant update the plugin version, nor unity version, our game is pretty big and i need a hotfix fast. Any hints on this would be really appreciated! Thanks in advance!
I'm not aware of the plugin but if its open source available on git, can help you out. It needs a change at the code level to accommodate the fix.