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 F

Gian Salaritan 0 Reputation points
2023-09-20T16:49:55.08+00:00

I am getting the below error for my Xamarin forms application when we upgraded to XF 5, and Android target version 13.0 (API Level 33).

  • I already tried to install the Xamarin.AndroidX.Work.Runtime, both (2.7.0 and 2.8.1.4) tested but, none of them works
  • Also tried to update the Autofac package to the latest version but still not working.
  • We don't even have Indent/PendingIndent on our codes.

This is the full error:

{Autofac.Core.DependencyResolutionException: An exception was thrown while activating Merchants.Mobile.ViewModels.LoginScreenViewModel -> Merchants.Mobile.Services.UserService -> Merchants.Mobile.Services.NetworkService -> Merchants.Mobile.GAService. ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor()' on type 'GAService'. ---> Java.Lang.IllegalArgumentException: com.merchantsfleet.totalview.mobile: 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 Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00068] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:12890 
  at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.g.cs:562 
  at Android.Gms.Analytics.GoogleAnalytics.GetInstance (Android.Content.Context context) [0x00047] in <042dd70b7d474228a46ee47cd2d94a1d>:0 
  at Merchants.Mobile.GAService..ctor () [0x0000e] in C:\Repositories\T\Mobile\Merchants.TotalView.Mobile\Merchants.TotalView.Mobile.Android\GAService.cs:16 
  at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,object[])
  at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate () [0x00066] in <74263cc0905c434eaecb065d73ff9572>:0 
   --- End of inner exception stack trace ---
  at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate () [0x000d5] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Activators.Reflection.ReflectionActivator+<>c__DisplayClass14_1.<UseSingleConstructorActivation>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00010] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
   --- End of inner exception stack trace ---
  at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00031] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Pipeline.ResolvePipeline.Invoke (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x0000a] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x0000b] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x000cc] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.ScopeSelectionMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x00093] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action`1[T] next) [0x000ac] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder+<>c__DisplayClass14_0.<BuildPipeline>b__1 (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x00079] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Pipeline.ResolvePipeline.Invoke (Autofac.Core.Resolving.Pipeline.ResolveRequestContext context) [0x0000a] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.ResolveOperation.InvokePipeline (Autofac.ResolveRequest request, Autofac.Core.Resolving.Pipeline.DefaultResolveRequestContext requestContext) [0x00006] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance (Autofac.Core.ISharingLifetimeScope currentOperationScope, Autofac.ResolveRequest request) [0x000ce] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation (Autofac.ResolveRequest request) [0x00070] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Resolving.ResolveOperation.Execute (Autofac.ResolveRequest request) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent (Autofac.ResolveRequest request) [0x00039] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.Core.Container.ResolveComponent (Autofac.ResolveRequest request) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.ResolutionExtensions.TryResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters, System.Object& instance) [0x0002e] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.ResolutionExtensions.ResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters) [0x00030] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.ResolutionExtensions.Resolve (Autofac.IComponentContext context, System.Type serviceType, System.Collections.Generic.IEnumerable`1[T] parameters) [0x00007] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Autofac.ResolutionExtensions.Resolve (Autofac.IComponentContext context, System.Type serviceType) [0x00000] in <74263cc0905c434eaecb065d73ff9572>:0 
  at Merchants.Mobile.Plumbing.Ioc.Resolve (System.Type objectType) [0x00001] in C:\Repositories\T\Mobile\Merchants.TotalView.Mobile\Merchants.TotalView.Mobile\Plumbing\Ioc.cs:17 
  at Merchants.Mobile.Plumbing.ViewModelLoader.LoadViewModel (System.Type viewModelType, System.Object parameter, Merchants.Mobile.Plumbing.IBundle savedState) [0x00001] in C:\Repositories\T\Mobile\Merchants.TotalView.Mobile\Merchants.TotalView.Mobile\Plumbing\ViewModelLoader.cs:20 
  at Merchants.Mobile.Plumbing.ViewPresenter.ShowNavigationPage (Merchants.Mobile.Plumbing.ViewModelRequest request) [0x0004b] in C:\Repositories\T\Mobile\Merchants.TotalView.Mobile\Merchants.TotalView.Mobile\Plumbing\ViewPresenter.cs:40 }
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,336 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,839 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.