Problem while add Xamrine.Android.Support.Design in Xamrine project(visual studio) by using nugget - visual-studio

I am trying to add nugget packages in my Xamarin.Forms project and Xamarin.Android project.
I am able to add below list of nuget packages to my Android project but I am not able to add them to the Xamarin.forms project.
I checked the target framework in the Android project (right click on android project -> Properties -> Application - > Compile using Android version). It is set to Android9.0(Pie)
Nuggets -
Xamrin.Android.Support.Design
Xamrine.Android.Support.Core.UI etc
whenever I try to add these nuggets it show below error.
Error NU1202 Package Xamarin.Android.Support.Design 28.0.0.3 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1). Package Xamarin.Android.Support.Design 28.0.0.3 supports:
- monoandroid60 (MonoAndroid,Version=v6.0)
- monoandroid70 (MonoAndroid,Version=v7.0)
- monoandroid71 (MonoAndroid,Version=v7.1)
- monoandroid80 (MonoAndroid,Version=v8.0)
- monoandroid81 (MonoAndroid,Version=v8.1)
- monoandroid90 (MonoAndroid,Version=v9.0)
For whatever reason, when I am trying to use below in my App.xaml.cs
#if __IOS__
using AVFoundation;
using FM.LiveSwitch.Cocoa;
using UIKit;
#else
using Android.Views;
using Android.Widget;
#endif
it shows the error
Error CS0246 The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly reference?)

Related

How to set xamarin forms project to mono android

I am trying out Telerik UI for Xamarin forms for the first time and while going through the documentation, one of the required android support library is Xamarin.Android.Support.Vector.Drawable(v28.0). I tried downloading the package from nuget and I get an error.
This is the error:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Xamarin.Android.Support.Vector.Drawable 28.0.0.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Xamarin.Android.Support.Vector.Drawable 28.0.0.1 supports:
- monoandroid60 (MonoAndroid,Version=v6.0)
- monoandroid70 (MonoAndroid,Version=v7.0)
- monoandroid71 (MonoAndroid,Version=v7.1)
- monoandroid80 (MonoAndroid,Version=v8.0)
- monoandroid81 (MonoAndroid,Version=v8.1)
- monoandroid90 (MonoAndroid,Version=v9.0) UITest C:\Users\FAITH\source\repos\UITest\UITest\UITest\UITest.csproj 1
I have looked up several solutions online and nothing works. I have also tried to change project target framework version and all I see is .NETStandard as the highest.
We should install the Xamarin.Android.Support.Vector.Drawable Nuget in xamarin android project.When we select the Nuget as follows , there is no such problem.

How to fix Error NU1202 Package Xamarin.Android.Support.CustomTabs

I'm building a Xamarin App!
When I install Xamarin.Android.Support.CustomTabs Nuget package it shows me this error and no other nuget package is updating even !
I tried everything searched on google but still I've no idea what to do with this error
Error:
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'Detail' does not exist in the current
context DummyApp C:\Users\hashir.malik\source\repos\DummyApp\DummyApp\DummyApp\MainPage.xaml.cs 29 Active
Error NU1202 Package Xamarin.Android.Support.CustomTabs 27.0.2 is not
compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package
Xamarin.Android.Support.CustomTabs 27.0.2 supports: monoandroid81
(MonoAndroid,Version=v8.1) DummyApp C:\Users\hashir.malik\source\repos\DummyApp\DummyApp\DummyApp\DummyApp.csproj 1
ScreenShot : https://i.stack.imgur.com/DaLBj.png
You're trying to install the package to the shared project which is .Net Standard 2.0.
The Packages only need to be installed to the Android project. So uncheck "DummyApp" and only check "DummyApp.Android" in NuGet UI.

Unable to install nuget packages in xamarin android project

I am facing a very strange issue regarding installing NuGet packages in the xamarin android project. When I try to install any NuGet package in xamarin android project getting an error.
Here is the error message I am getting from the NuGet package manager.
?Restoring packages for E:\Projects\Sample\Sample1\Sample2\Smaple3\SampleApp.Android\SampleApp.Android.csproj...
NU1202: Package Microsoft.WindowsAPICodePack.Shell 1.1.0 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Microsoft.WindowsAPICodePack.Shell 1.1.0 supports: net (.NETFramework,Version=v0.0)
NU1202: Package Microsoft.WindowsAPICodePack.Core 1.1.0 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Microsoft.WindowsAPICodePack.Core 1.1.0 supports: net (.NETFramework,Version=v0.0)
Package restore failed. Rolling back package changes for 'SampleApp.Android'.
Time Elapsed: 00:00:01.9192186
========== Finished ==========
Installed packages in the Android project:
Remove Microsoft.WindowsAPICodePack from your PCL, since you are having a reference of it in the PCL and then your Android project refers the PCL that works like an indirect reference hence it is causing the issue.
Solution: remove the package from PCL project

Could not load assembly 'Newtonsoft.Json. Perhaps it doesn't exist in the Mono for Android profile?

The whole exception message below:
Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Newtonsoft.Json, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Perhaps it doesn't
exist in the Mono for Android profile?
I have changed my PCL library to .Net standard 1.6 and i can run library and IOS project successfully. But my android project gave me the above error. If i add the Newtonsoft.Json package to it it gives me different error.
error: package com.squareup.okhttp does not exist
com.squareup.okhttp.Callback
I am stuck with these errors.
This error happens at compile-time when you have the Newtonsoft.Json NuGet Package installed in the .NET Standard project and do not have it installed in the Android project.
To fix it, add the same version of the Newtonsoft.Json NuGet Package to the Android project as well as the .NET Standard project.

Getting the error "Error CS0234: The type or namespace name `CrossCore' does not exist in the namespace `Cirrious'

Getting the error "Error CS0234: The type or namespace name CrossCore' does not exist in the namespaceCirrious'. Are you missing an assembly reference?" for PCL. And unable to update packages.
We are getting error when we are trying to update packages in Xamarin studio PCL in Mac machine. “Could not install package 'MvvmCross.PortableSupport 3.2.2'. You are trying to install this package into a project that targets 'portable-Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.”
If you are updating an old MvvmCross project then that is probably why. Starting with 3.2.1 MvvmCross moved to PCL profile 259. You'll need to change the profile of your pcl core to this profile or something else that is compatible.
After uninstall xamarin by following steps in the url http://developer.xamarin.com/guides/cross-platform/getting_started/installation/uninstalling_xamarin/
and reinstall the Xamarin Studio, the Nuget packages are started updating.

Resources