ACR User Dialogs not working in Android PCL

ksoluckyksolucky USMember ✭✭

I am trying to use ACR User Dialog in my PCL Project. It works like a charm in my iOS project build but when I try to build my Android Project, it gives me the below error:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'AndHUD, Version=1.2.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'AndHUD.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) TimPapp.Droid

I already have AndHUD 1.2.0 package installed in NuGet. Any idea what can be the reason? Appreciate any help.

Best Answers

  • ksoluckyksolucky US ✭✭
    Accepted Answer

    Yes, I already have. There was something wrong with the AndHUD package that comes with Acr.UserDialog.

    I solved this issue by manually adding Acr.Support.Android reference from my NuGet package directory in my android project.

  • ksoluckyksolucky US ✭✭
    Accepted Answer

    Found out that the reference to SPLAT package was not there in my android project. So I have resolved this issues by manually adding SPLAT package reference in my android package.

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I suggest to open an issue on Github site
  • ksoluckyksolucky USMember ✭✭

    I did. Still keeping my question open here in case, anyone knows how to solve this issue.

  • Sahadev_GuptaSahadev_Gupta INMember ✭✭✭

    @KartikSolanki Have you intialized UserDialogs in your Android MainActivity.cs

  • ksoluckyksolucky USMember ✭✭
    Accepted Answer

    Yes, I already have. There was something wrong with the AndHUD package that comes with Acr.UserDialog.

    I solved this issue by manually adding Acr.Support.Android reference from my NuGet package directory in my android project.

  • SmeSme USMember ✭✭✭

    If your Android.Support packages are version 23, you can't use the latest version of ACR user dialogs. You need to use a version <= 6.3.10

  • ksoluckyksolucky USMember ✭✭

    I am using 6.3.10. But then while creating a release build, I am getting this error:

    The "LinkAssemblies" task failed unexpectedly.
    Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Android.Graphics.Drawables.Drawable Splat.BitmapMixins::ToNative(Splat.IBitmap)' (defined in assembly 'Acr.UserDialogs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Graphics.Drawables.Drawable Splat.BitmapMixins::ToNative(Splat.IBitmap)
    at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
    at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
    at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
    at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
    at Mono.Linker.Steps.MarkStep.ProcessQueue()
    at Mono.Linker.Steps.MarkStep.Process()
    at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
    at Mono.Linker.Pipeline.Process(LinkContext context)
    at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, LinkContext context)
    at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
    --- End of inner exception stack trace ---
    at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() GBYA.Droid

  • ksoluckyksolucky USMember ✭✭
    Accepted Answer

    Found out that the reference to SPLAT package was not there in my android project. So I have resolved this issues by manually adding SPLAT package reference in my android package.

  • LoguLogu INUniversity ✭✭
    edited January 2018

    I added Acr user Dialog in my Application for the Popup Alert Implementation but it is working Fine in IOS and facing Exception in Android. Can any one please help on this. Here is the Following Exception i am getting.

    I also added Splat and Acr Support packages as @KartikSolanki Suggested. But facing the below Exception.

    The exception stacktrace is as follows:
    {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not resolve type with token 01000023 (from typeref, class/assembly Splat.Resource, Splat, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <657aa8fea4454dc898a9e5f379c58734>:0
    --- End of inner exception stack trace ---
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <657aa8fea4454dc898a9e5f379c58734>:0
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
    at Android.Runtime.ResourceIdManager.UpdateIdValues () [0x000b4] in <0fb41b3e3d7346ce92c4a742b20078ff>:0
    at Xamarin.Forms.Platform.Android.Resource+Attribute..cctor () [0x0000a] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\Resource.cs:23 }

  • IRONicMANIRONicMAN Member ✭✭

    I solved my problem by rolling back AnHUD to version 1.2. Version 1.4 does not seem to be supported by Acr.UserDialogs

  • hyteahytea Member

    Thank you @IRONicMAN that seemed to be my issue as well.

  • DanielJoshuaPollackDanielJoshuaPollack Member ✭✭
    edited February 5

    2019...Now I am seeing this issue. I have AndHud version 1.4.1, Acr.UserDialogs v7.0.1, Acr.Support v2.1.0, Acr.MvvmCross.Plugins.UserDialogs v5.0.0. Tried to build in release mode:

    Severity Code Description Project File Line Suppression State
    Error The "LinkAssemblies" task failed unexpectedly.
    Mono.Linker.MarkException: Error processing method: 'System.Void Acr.UserDialogs.ProgressDialog/<>c__DisplayClass18_0::b__0()' in assembly: 'Acr.UserDialogs.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void AndroidHUD.AndHUD::Show(Android.Content.Context,System.String,System.Int32,AndroidHUD.MaskType,System.Nullable`1<System.TimeSpan>,System.Action,System.Boolean,System.Action)
    at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
    at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
    at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
    at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
    at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
    at Mono.Linker.Steps.MarkStep.ProcessQueue()
    --- End of inner exception stack trace ---
    at Mono.Linker.Steps.MarkStep.ProcessQueue()
    at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
    at Mono.Linker.Steps.MarkStep.Process()
    at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
    at Mono.Linker.Pipeline.Process(LinkContext context)
    at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Toolbox.Forms.Droid

  • blaylock95blaylock95 Member
    edited February 5

    @DanielJoshuaPollack i had the same issue, downgrading AndHUD to 1.2.0 is good temporary solution

    Actual problem is somewhere else

Sign In or Register to comment.