I am facing below issue when I updated the target platform of the Android to 34
.
Java.Lang.IllegalArgumentException: 'com.companyname.appname: 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.'
I already faced this same issue on .Net standard Xamarin Forms Project
and I have resolved it by this thread. As per the thread I have added Xamarin.AndroidX.work.runtime 2.7.1.5
, updated all the Firebase Packages
to latest and set the PendingIntentFlags
to Mutable
like below.
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.Mutable);
But now I am facing the same issue on a Portable Xamarin Forms Project
and the same solution mentioned above is not working.
When I install the Xamarin.AndroidX.Work.Runtime 2.9.0.1
I am getting the below error:
Could not install package 'Xamarin.AndroidX.Work.Runtime 2.9.0.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v11.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
When I try to update the Firebase Packages
to latest I am getting the below error.
Could not install package 'Xamarin.Firebase.Iid 121.1.0.7'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v11.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
And when setting the PendingIntentFlags
, the Mutable
flag is not available. Available flag screenshot adding below:
Is there any other solution to fix this issue for Portable Xamarin Forms
project? We have started the MAUI Migration
for this project but it takes time, but I need to push it to stores immediately with version changes.