locked
Xamarin forms FileNotFoundException Xamarin.Android.Support.v4 RRS feed

  • Question

  • User46478 posted

    I have created Xamarin Forms(Portable Class Library) project 2 weeks ago. And when i am going to compile it today, it gives such error:

    Error 3 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Android.Support.v4.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute() Epul.Android

    maybe i have changed somethink. but not remember what.

    What may be cause this error?

    Friday, October 24, 2014 6:36 AM

Answers

  • User14 posted

    I think I saw this, and fixed by deleting the Xamarin.Forms package and re-adding it via NuGet. Just doing it in the Android project seemed to be enough.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, October 24, 2014 9:14 PM
  • User68480 posted

    This worked as a temporary fix, however if you then click on the solution and choose "Update packages" you will get the error again. So, now you have to be on your tip-toes not to click on update packages.

    This is easily reproduced: Create a new Xamarin Forms app, click update packages on the solution, build and voila!

    It seems unlikely that using Xamarin Forms should prevent us from using the update packages feature without going through the hassle of manually removing the packages and re-adding them via nuget?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, November 4, 2014 7:45 PM

All replies

  • User14 posted

    I think I saw this, and fixed by deleting the Xamarin.Forms package and re-adding it via NuGet. Just doing it in the Android project seemed to be enough.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, October 24, 2014 9:14 PM
  • User68480 posted

    This worked as a temporary fix, however if you then click on the solution and choose "Update packages" you will get the error again. So, now you have to be on your tip-toes not to click on update packages.

    This is easily reproduced: Create a new Xamarin Forms app, click update packages on the solution, build and voila!

    It seems unlikely that using Xamarin Forms should prevent us from using the update packages feature without going through the hassle of manually removing the packages and re-adding them via nuget?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, November 4, 2014 7:45 PM
  • User18049 posted

    @WilliamRaiford? - Yes it should not require you to manually remove and re-add the NuGet packages. It looks like a bug in Xamarin Studio's NuGet update. Visual Studio seems to correctly update the Xamarin.Android.Support.v4 package by also installing the extra Xamarin.Android.Support.v13 package which Xamarin.Android.Support.v4 depends on. For some reason Xamarin Studio does not do this.

    Wednesday, November 5, 2014 10:23 AM
  • User18049 posted

    I have opened a bug for this.

    Wednesday, November 5, 2014 10:34 AM
  • User126619 posted

    Xamarin Studio (XS) showing an update for Parse package. I updated via XS and am getting same System.IO.FileNotFoundException. I have removed and added the package via XS but gettting same. Cannot build project now.

    Bug 24276 shows "verified fixed". But, there seems to still be some issue with NuGet package updates in XS.

    Any suggestions?

    Monday, May 25, 2015 2:59 PM
  • User18049 posted

    @brady5 - Can you post the IDE log and the build error?

    Bug 24276 was for a problem when updating the NuGet package in Xamarin Studio. Removing it and then installing it again was a workaround for this bug so it may be something other problem is happening to you since you have tried the workaround.

    Monday, May 25, 2015 3:18 PM
  • User126619 posted

    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Android.Support.v4.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Myapp)

    Monday, May 25, 2015 3:36 PM
  • User18049 posted

    There are no errors in the IDE logs. The build output does not reveal anything.

    I am assuming the project file has the Xamarin.Android.Support.v4.dll referenced. If that is the case then can you file a bug on bugzilla with detailed information on your configuration and the build output log with the verbosity turned up to diagnostic? Not sure which IDE you are using, but you can get diagnostic output by using msbuild on the command line:

    msbuild path/to/yoursolution.sln /t:Rebuild /v:diag > build.log
    
    Monday, May 25, 2015 4:22 PM
  • User126619 posted

    I have Mono.Android (Xamarin.Android v4.4 Support) referenced.

    I am using Xamarin Studio 5.9 (build 431)

    For now I have rolled back my code to the point before I updated the Parse NuGet package and builds are good again.

    Monday, May 25, 2015 4:45 PM
  • User18049 posted

    The .dll in the screenshot is from Parse and is Parse.Android.dll. The error from your build log is for Xamarin.Android.Support.v4.dll which is not being referenced by your project looking at the screenshot.

    What NuGet packages including versions do you have installed now that you have rolled back your project? Then what did you do that then caused the build to stop working?

    Monday, May 25, 2015 5:05 PM
  • User126619 posted

    After rolling code back I have Parse 1.4.1 package. Build is good with this version.

    If I update the Parse package it gets updated to Parse 1.5.0 and then build starts failing with the System.IO.FileNotFoundException (Xamarin.Android.Support.v4.dll)

    Monday, May 25, 2015 5:23 PM
  • User18049 posted

    OK this is a different problem. It looks like it is a problem with the latest version of the Parse NuGet package.

    When I install Parse 1.5.0 NuGet package into an Android project, without any other components or NuGet packages, and then build the project I see the error about the missing Xamarin.Android.Support.v4.dll file.

    Looking at the Parse NuGet package it does not include this Xamarin.Android.Support.v4.dll nor does it have a dependency on the Xamarin.Android.Support.v4 NuGet package. If I install the Xamarin.Android.Support.v4 NuGet package separately then I can then build the Android project with Parse 1.5.0.

    So my guess is that one of the assemblies in the Parse 1.5.0 NuGet package is compiled against Xamarin.Android.Support.v4.dll. The Parse NuGet package should probably depend on the Xamarin.Android.Support.v4 NuGet package

    Parse 1.4.1 seems to be OK. Parse 1.5.0 was released a few days ago so the Parse developers may not be aware of the problem. This is probably worth reporting this and logging a bug with Parse.

    Monday, May 25, 2015 6:33 PM
  • User126619 posted

    I added the Xamarin.Android.Support.v4 NuGet package then updated the Parse NuGet package to 1.5.0 and build is good now.

    Reported to Parse...

    Thanks, I appreciate the help!

    Monday, May 25, 2015 6:54 PM
  • User199627 posted

    help plz
    anyone know how i can fix it?

    Severity Code Description Project File Line Suppression State Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Syncfusion.GridCommon.Portable, Version=13.4451.0.58, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Syncfusion.GridCommon.Portable.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute() App8.Droid

    Thursday, March 10, 2016 5:46 PM
  • User95501 posted

    Hi @AmmarAl-Suhairy,

    Sorry for the delay.

    Please check whether the Syncfusion.GridCommon.Portable is referred in your project. If not please refer it from the below location. {Syncfusion Installed location}\Essential Studio[release version]\lib\pcl\Syncfusion.GridCommon.Portable.dll

    Also please ensure whether all the reference of the Syncfusion assemblies are in order.

    Wednesday, April 6, 2016 12:32 PM
  • User228891 posted

    the best way is goto TOOL>NUGET PACKAGE MANAGER>PACKAGE MANAGER CONSOLE THEN
    1st uninstall xamarin.Form Package and then reinstall

    Friday, May 27, 2016 7:20 AM
  • User259500 posted

    @CraigDunn said: I think I saw this, and fixed by deleting the Xamarin.Forms package and re-adding it via NuGet. Just doing it in the Android project seemed to be enough.

    Can't believe a bug from October 2014 still exists...

    It's been 2 years, Xamarin please fix this.

    Saturday, October 15, 2016 12:18 PM
  • User276517 posted

    Just ran into this with a fresh install of VS 2017 and a brand new project.

    Friday, November 18, 2016 9:04 PM
  • User216866 posted

    I did it (VS 2017) during Connect()/2016, the same thing. I have tried couple ways to fix it. Unsuccessful. Uninstallation Xamarin.Forms was successful, installation is not. Hermetic art, purely.

    Wednesday, November 23, 2016 12:58 AM
  • User216866 posted

    Year, just an alchemy. I have downgrade *.Recycler package to pervious version. Then updgrade it up to original version. VS 2017 require restart. After restarting IDE restore a lot of packages (several minutes it have taken). Now it is fixed. I am not sure I can repeate it again. Just for an infromation. No any guarantee.

    Wednesday, November 23, 2016 1:49 AM
  • User281575 posted

    I have this problem " PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?" and i can't resolve!! :(

    Monday, December 5, 2016 10:19 PM
  • User253201 posted

    how can i solve there yellow error :/

    Saturday, March 18, 2017 9:57 PM
  • User200049 posted

    @MuhammadBilalLiaquat I guess those files are already broken. You can remove it and install "Xamarin forms" via nuget packages. Create a new thread so we can clearly fix there. Thanks :)

    Monday, March 20, 2017 12:09 AM
  • User253201 posted

    @MarkVincent I am not using Xamarin.Forms i am doing my work in Xamarin.Android and when i install package via nuget it said the file already exist in the project. :/ Confusion.

    Monday, March 20, 2017 11:29 AM
  • User112691 posted

    i got a similar "Exception while loading assemblies: System.IO.FileNotFoundException......" exception on VS 2017.the solution is very much valid.i removed xamarin forms from nuget manager and added the same back.issue resolved.thanks!

    Monday, April 3, 2017 9:49 PM
  • User328416 posted

    @CraigDunn Thanks for you answer. Just by adding one layout I run myself into nonsense errors. Always that I must use VS20XX or something derivate from Microsoft I pass half of my time with building issues. Just God knows how much I like to work with MS technologies.

    Sunday, June 4, 2017 11:29 PM
  • User246589 posted

    This problem is produced by bad data and duplication inside the packages folder. Please delete your all the packages inside the packages folder and restored in Visual Studio by click Restore Nuget Packages.

    Good Luck :)

    Wednesday, August 9, 2017 4:45 AM