Xamarin Forms Deployment Fails After Update - c#

After updating Xamarin from visual studio , Xamarin.Forms application gives this exception when running
System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener not found
I did try to update the Nuget Packages, re-install Xamarin for visual studio, re-install android sdk, no thing worked .
How can I solve it ?

Maybe you have updated packages Android.Support.xxxx. Try it:
Uninstall the Xamarin Forms packages and all the android support packackage.
Reinstall just the latest Xamarin Forms Nuget package. Letting it grab the Android support packages. Ignore any Android.Support.xxxx updates.

So I just reproduced your issue and I am sorry that you and other ran into this. It looks like there was an issue in the templates and I am working with the team to quickly resolve this.
To fix:
Simply right click on the android project and select "Manage Nuget Packages"
Go to Updates
Find Xamarin.Android.Support.v7.AppCompat
Select version 23.3.0 from the version picker and hit Install
You additionally will need to install the RecyclerView 23.3.0 NuGet Package. * Go to Browse and search for: Xamarin.Android.Support.v7.RecyclerView and make sure to pick 23.3.0 to install for the correct version
Now do a full clean/rebuild and it should work
This should install the correct versions of everything you need for Android
Optionally, you can select just Xamarin.Forms and update to the latest version on ALL projects and it should update all references that it needs.

Please upgrage your xamarin.forms NuGet package to lastest version.

Xamarin Forms Deployment Fails After Update using Visualstudio
System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener not found. below image
am using Visual studio 2015 in android uninstall all packages
next install xamarin.forms package only.
then it is working fine..
Note:upgrade a new versions in Pcl,android (Xamarin.Forms v2.3.1.114)versions and pcl and andriod versions are most be Same

Related

Error when building Xamarin project

I'm receiving this error everytime i try to build my xamarin project
Can not resolve reference: `Parse`, referenced by `Project`. Please
add a NuGet package or assembly reference for `Parse`, or remove the reference
to `Project`. Project.Android
So far I've tried:
Deleting all the folders in packages > restarting VS2017
Running VS2017 as Admin
None of those worked, anyone has any idea how to fix this?
Thanks in advance.
I changed the Android version to 10.0 from 11.0, uninstalled and reinstalled Parse again and it worked.
Edit
Stopped working again. Upgraded to the 2.0.0 version as per this link - https://github.com/parse-community/Parse-SDK-dotNET/issues/303
Edit
Stopped working again. Went back to the 1.7 version but this time didn't use the Nuget package. Extracted Android and IOS dlls and added them manually as references. Working now.
Edit
Download Parse-1.7.0.zip
from https://github.com/parse-community/Parse-SDK-dotNET/releases/tag/1.7.0
Extract the contents.
Add Parse.Android.dll to the Android project.
Add Parse.iOS.dll to iOS project.
Add Parse.dll to Assemblies in the main project.

NuGet package install fails "Package restore failed. Rolling back package changes for <xamarin.android>"

Installing any package fails with this error, updating packages also creates this error. Clearing the NuGet cache files causes this error to change to "access to the path mono.cecil.dll is denied" when trying to install "Xamarin.GooglePlayServices.Ads". Restarting visual studio causes the package restore error to come back.
Versions:
OS: win 10
Visual Studio Information:https://pastebin.com/vnuyZMWk
Xamarin.Forms Project:
Target framework: .NET 2.0
Xamarin.Android project:
Minimum Android Version: 5.0 (API Level 21)
Target Android Version: Use Compile Using SDK version (8.0)
Well after some trial and error I have the solution.
Visual Studio:
Update visual studio https://pastebin.com/GkEeRqg3
Updates Xamarin.Forms and NuGet
Repair visual studio from the "Visual Studio installer"
This Fixes the access denied to *.dll error
Xamarin.Android project:
Set Target Android Version: 8.1 API 27
This makes the packages the require monoandroid81 happy.
Cleaning house
Delete the folder C:\Users\<Your_Name>\AppData\Local\Xamarin`
Not sure if this was necessary but I am documenting anything I did so others can replicate the solution.
Fixing NuGet
Right-click <Project_name>.android --> Set as startup project.
Tools --> NuGet Package Manager --> Package Manager Console
In the console CLI run Update-Package -Reinstall
Why did this happen?
One way or another some of the NuGet packages used in Xamarin.Android used monoandroid81. Even though my solution was set to use 80 some NuGet packages installed were only compatible with 81. This was shown in the NuGet Console.
Package Xamarin.Android.Support.v7.MediaRouter 27.0.2 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.MediaRouter 27.0.2 supports:
monoandroid81 (MonoAndroid,Version=v8.1)
I faced the same error when I was trying to update the libraries one by one. Then I tried selecting all required libraries and clicked the Update button bellow the search box and it works. I have to tell that these libraries had dependencies between each other.
Here's an example:

How can I update my xamarin android project with the latest NuGet packages support libraries?

I'm using vs 2013 and xamarin version 4.7, for about 2 months I have been trying to install packages Xamarin.Android.Support.v7.RecyclerView, Xamarin.Android.Support.v7.AppCompat
and Xamarin.Android.Support.v4 and some other packages but I always receive the same error that says :
"Could not install package 'package Name'. You are trying to install
this package into a project that targets 'mono.Android,Version=v5.0',
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"
I've updated my xamarin android component to the last version, research this site, other site and test install packages by other android api version but my problem does not solve.
Can anybody help me?
Sahar,
If you are not compiling your application using Android version 7.0 (API Level 24 - Nougat), you can't install the latest support libraries 24.2.1 and above. The latest contains assemblies only compatible with MonoAndroid70, hence the error message.
As I see in the error message you are compiling using Android version 5.0 (API Level 22 - Lollipop), meaning the highest version of the support libraries you can install is 23.4.0.1. That version contains assemblies compatible with MonoAndroid403.
If you are not ready to move to Nougat, it's ok not to have the latest version of the support libraries.
If you're running Visual Studio 2017 on Windows, try these two steps:
Step One:
Make sure you're running the latest version of Visual Studio 2017 or higher. Then, go to QuickSearch (Control-Q) and look for "Xamarin Android". Select "Xamarin - Android Settings".
Scroll down and check the box for "Auto Install Android SDKs".
Step Two:
In your Android project, get Properties, then open the Application tab. Next to Compile using Android version: (Target Framework), select the latest SDK.
Then, under the Android Manifest tab, select Target Android version and select Use Compile using SDK version. You can still support earlier versions of Android - just select what you want, within reason, from the Minimum Android version dropdown. Be careful here - supporting super early versions of Android is likely fraught with peril.
Once you've taken care of these steps, you should be able to install the latest Android support libraries. I imagine there are similar steps to VS Mac, but I haven't checked.
Good luck!

Nuget Packages are missing in Visual Studio

I have been using xamarin studio, it works fine when I download a sample project from mvvmcross. It compiles and deploys the device perfectly.
But when I open the project in the visual studio, there are a lot of missing packages for some reasons. Is there a way of handling ? I am using Nuget 2.8 in Visual studio 2013
When I open Nuget as follows, there is a button to restore the missing packages. I clicked on it.
Then it is attempting to download the missing packages, and then it realizes there are dependencies as follows:
Then I am attempting to download the dependency manually as follows but it shows the packages has already downloaded but I am still seeing the missing packages in the solution, nothing is affected.
Therefore I am getting hundreds of errors as follows:
When I take a look at the property of missing packages, I see as follows
You should update your NuGet Package Manager extension in Visual Studio and then try restoring the packages again.
The restore error MvvmCross.Binding already has a dependency defined for MvvmCross.Core is caused by an old version of the NuGet package manager extension not recognising the newer target frameworks that the MvvmCross.Binding NuGet package is using in its group dependencies. This bug has been fixed in a newer version of the NuGet Package Manager.
If you search for the 'already has a dependency defined' error message you will find several cases of this, such as this StackOverflow question, for example:
Can not install NuGet package
Right click on the solution in solution explorer and choose 'restore nuget packages'

Installing facebook c# sdk

I couldn't find any other questions on this...so I must be doing something wrong. I have never used NuGet before, so my problem could very well be there.
Anyways, I am making a WP8 app in VS2012. I went Project > Manage NuGet Packages > Online > Facebook. It is version 6.4.0. When I hit install, I get the following error:
Could not install package 'Facebook 6.4.0'. You are trying to install
this package into a project that targets 'WindowsPhone,Version=v8.0',
but the package does not contain any assembly references that are
compatible with that framework. For more information, contact the
package author.
Any idea how to resolve this?
I had the same problem, for me updating Nuget package installer worked. Initial version was 2.0 and it got upgraded to 2.5. Go to Tools=> Extensions and Updates => Updates => Visual Studio Gallery. There you can see update available for Nuget installer. After updating Nuget try installing facebook and facebook client packages.Hope this works....
The error you're seeing means that the package you tried to install for Nuget is incompatible with WP7/8 projects. Look at this Nokia article that explains how to use a modified version of the Facebook Graph API in a WP7/8 project.
I also faced this issue but, the previous version works fine.
go to tools => library package manager=>package manager console
and type
Install-Package Facebook -Version 5.3.2.0
and press enter.
Hope this will help :)

Categories