1

I suddenly started getting this error on my Xamarin forms project

/Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/xbuild/Microsoft/NuGet/Microsoft.NuGet.targets(184,5):

 error : Your project is not referencing the "MonoAndroid,Version=v8.0" framework. Add a reference to "MonoAndroid,Version=v8.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.

I tried to add different references but couldn't solve the issue. So, I reset the files to the last commit which was working fine but even then, I am getting this error on my android project.

Ali123
  • 740
  • 13
  • 38
  • this issue is driving me crazy, I tested with other projects and they are working fine. Just this project is giving me issues. I also branched to different commits to see if I did something on the way. – Ali123 Apr 10 '18 at 12:15
  • Please look [this](https://stackoverflow.com/questions/36190601/your-project-is-not-referencing-the-netframework-version-v4-5-framework). – Robbit Apr 11 '18 at 10:02
  • @JoeLv-MSFT Thanks for your response. I have Visual Studio for Mac and I don't have the option to restore packages at the project level. I also don't have a project.json file. I am not sure where to find it. – Ali123 Apr 11 '18 at 10:08
  • Hi, have you installed the Android SDK Platform27? Take a look [here](https://qiita.com/Frog_woman/items/6164a3bf4bd175ccc764), the author also is using the Mac. And [here](https://forums.xamarin.com/discussion/123743/xamarin-froms-onpropertychanged-from-another-page) – Robbit Apr 11 '18 at 10:24
  • Thanks for your multiple responses. I really appreciate it. This shouldn't be connected to my issue but I am not facing the problem right now after updating MacOS. – Ali123 Apr 11 '18 at 12:54

2 Answers2

3

I did the following that worked for me:

  1. Build > Clean All
  2. Close Visual Studio
  3. Got to solution Directory > in each Project and delete bin and obj folder
  4. Open Visual Studio
  5. Build > Rebuild All

Its like food , if you skip a step it will not work.

LeRoy
  • 4,189
  • 2
  • 35
  • 46
1

First , try clean and restore nuget packages if this don't solve the problem cleaning the nuget caches should solve , from tools>options>nuget package manager > clear all nuget cache and don't forget to put android 8 as target android version in project properties.

Houssem
  • 1,042
  • 7
  • 16
  • I don't have the option to clear Nuget cache on Visual Studio for Mac. Is there a CLI option for Mac? Thanks for your response. – Ali123 Apr 11 '18 at 05:28
  • I followed this guide to clear the cache https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache I am still getting the same error though. I am not sure how to target the android 8 version. But I tried different options on targeting framework such as 8.1 , 8.0,.. – Ali123 Apr 11 '18 at 05:37