I attempted to use Xamarin.Android.Support libraries version 25.3.1 but because of a bug I decided to downgrade back to my previous version 23.3.0. After Downgrading I am getting this error message below. whatever I tried, i cant get rid of it. I tried to delete all bin, obj, tmp etc folders. restarted VS2015, clean,rebuild...
Severity Code Description Project File Line Suppression State
Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly
'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral,
PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver)
I found out a small change in my package.config file. All below targetFramework="monoandroid71" now. Before upgrade-downgrade, they were targetFramework="monoandroid70", I replaced them manulla but, it didnt help at all. How can I fix this problem?
<package id="Xamarin.Android.ShortcutBadger" version="1.1.809" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.CustomTabs" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v7.Palette" version="23.3.0" targetFramework="monoandroid71" />
How my settings looks like
References:
UPDATE: I have reinstalled all nugetpackages and succeed to run android project on 1 pc but interesting thing is same project is not running on another pc. It returns different but similar error.
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'myApp, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'myApp.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() myApp.Droid
My problem is i updated xamarin form to 2.5.0.121934, Then, it shows Error "Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?"
So i downgrade my xamarin.form to 2.3.4.247, then it build successfully.
The best option here is to uninstall ALL Xamarin and Android packages from your Xamarin.Android project. Then install Xamarin.Forms again, and it will add in the correct dependencies.
Alternatively, try downloading
Install-Package Xamarin.Android.Support.Fragment
Sadly the steps described here did not help me. But i got around to the cause.
First step of action is to determine what package wants to use the support.Fragment packages.
To do so set your MsBuild output to Diagnostics. (tools => options => projects and solutions => Build and run)
Then build, once the error has been reported find the support.fragment in the log.
In my case it was Acr.Userdialogs that tried to get the support.Fragment framework.
Dependency "Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null". (TaskId:415)
Could not resolve this reference. Could not locate the assembly "Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null". Check to make sure the assembly exists on disk.
If this reference is required by your code, you may get compilation errors. (TaskId:415)
Required by "Acr.UserDialogs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL". (TaskId:415)
From here on it was a matter of downgrading the Acr.Userdialogs framework until this dependency was gone.
Hope this helps :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With