when create xamarin.android app has error - c#

Hello When I create a Xamarin app on Android, I encounter the following errors after creating the application
1-failed linking file resources. 2-attribute layout_behavior (aka
com.companyname.app2:layout_behavior) not found.
After seeing this problem, I saw the used version of Android, which was Android 11, and changed it to version 8.1.
The errors were fixed, but it showed me new errors
Package Xamarin.Google.Android.Material 1.0.0.1 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Xamarin.Google.Android.Material 1.0.0.1 supports: monoandroid90 (MonoAndroid,Version=v9.0)
Package Xamarin.AndroidX.AppCompat 1.2.0.5 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Xamarin.AndroidX.AppCompat 1.2.0.5 supports: monoandroid90 (MonoAndroid,Version=v9.0)
Because the program has an error, I can not use nuget
And I guess Visual Studio builds my project with Android 11 libraries.
But I do not know how to change this
Please help me to fix the errors

This problem was not resolved and eventually I had to replace Windows and reinstall Visual Studio
And after reinstalling Visual Studio, I no longer had this problem

Related

Downgrading .NET Framework causing packages issues

I am working on a project on TFS. This project was created on someone else's PC on VS 2017 and the newest .NET framework and published to Azure.
I got the project on my PC, I have VS 2015 and I had to change the .NET framework of the project to 4.6. Everything was fine, I could make changes to the project and commit.
But when I tried to publish to Azure from my PC, I got a very unclear error:
Publish Failed
Connecting to ...
Looking for solutions online, I had to downgrade the version of the package Microsoft.Net.Compilers from 2.6.1 to 2.4.0 . And that worked !
I turned off my PC. Next day when I opened the project and ran it, I got this error locally :
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.6.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I tried to uninstall Microsoft.ApplicationInsights and reinstall it with version 2.6.1 , but it says i need a newer version of nuget.
I am not sure how to proceed from here. I already installed all the updates in my Tools -> Extensions -> Updates but nothing changed.
Why are all these things happening to my project and how can i fix it?
PS: upgrading my VS to 2017 is currently not an option due to many exterior reasons.
Thank you.
I've gotten that error locally as well and was actually able to resolve by manually adding the file to my project folder, may be worth a shot.
Downgrading .NET Framework causing packages issues
Just like Hans said nuget packages change quite rapidly, which often require the latest version NuGet. Some new features in the package only supported by the newer NuGet (like PackageReference) or some issues fixed on the newer version. For example, install package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 on Visual Studio 2015, which requires NuGet client version '3.6.0' or above.
So, the workaround for this issue is create a new project with Visual Studio 2015, copy the code from previous projects, then add those nuget package one by one to find out the reason why it needs the newer version nuget.
However, I want to talk more over about this question is that the best way to resolve this issue is to install Visual Studio 2017 alongside Visual Studio 2015. As we known, using a lower version of the Visual Studio and .net framework to open a higher version of the Visual Studio and .net framework is not recommended, it will always bring a lot of incompatibility errors and some other weird issues. Since upgrade your Visual Studio to 2017 is currently not an option due to many exterior reasons, so I suggest that you can install Visual Studio 2017 alongside Visual Studio 2015. Besides, developing the same project with different versions of Visual Studio and submitting it to the TFS server may bring many unpredictable risks.
Hope this helps.

Xamarin cannot install package System.Security.Principal.Windows 4.3.0 MonoAndroid,Version=v7.1

I Have tried install MySql.Data but for each time I have error about the package does not contain any references etc. That same problem I have got when I was trying install updates Xamarin.Android.Support. I changed in project properties Android Version but still not working.
You need to change 'Target Framework' in 'Build -> General' section to at least Android 7.1

Unable to install Xamarin.Android.Support.Compat

I'm working on android project, for which I'm using xamarin.
So after creating a blank application which has a target version 6.0 Marshmallow, I'm trying to install Xamarin.Android.Support.Compat nuget library, but I'm getting this error
Could not install package 'Xamarin.Android.Support.Compat 24.2.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.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 don't know how to solve this issue. I'm new to mobile developing.
Could anyone please help me with this issue. I'm sure I'm not the one with this issue here.
Thanks before hands.
You'll need to install API 24(7.0) and set your Droid TargetFrameworkVersion to Android 7.0 or bigger.
Read the following documentation about android versions.
All the API version , included version 25, are installed and the Target Version is set to Android 7.0, but I'm still getting that error message.
We should always use the same API level as the version for the Support Libraries you reference, for the Xamarin.Android.Support.Compat lib version 24.2.1, it is for API level 24 (Android 7.0). We need to make sure Target Android version as well as the Compile using Android version are all set to Android 7.0 in order to install this package of version 24.2.1 or 25.1.1.
For API level 23(Android 6.0), the package version should be 23.x, but I just failed to find the package of that version.
Restart Your Pc. It fixed for me
even i was doing every thing right while installing support v7 but i was getting the same error as yours so i restarted my pc and tried installing again and it has successfully installed.

How to use DotNet.Contracts NuGet package?

Could someone shed some light on how to use the DotNet.Contracts NuGet package in Visual Studio 2015 and 2017? Is it the only component required to use Code Contracts in Visual Studio???
Do I still need to install Contracts.devlab9ts.msi??? When trying to install Contracts.devlab9ts.msi, I got error 'Extensions' is not a valid short file name. This occurs on my Windows 10 dev machine, with latest Windows updates.
If we still need to install Contracts.devlab9ts.msi, what's the purpose of the NuGet package?
You just need to install the DotNet.Contracts NuGet Package in your project, because this package contains all Code Contracts related files.
Please refer to:
https://github.com/Microsoft/CodeContracts/issues/13
The Contracts.devlab9ts.msi could be installed on my Windows 10 build 10240 successful. If you still want to install Contracts.devlab9ts.msi for your Visual Studio, please check your Windows 10 version and make sure your Windows 10 dev has installed all updates.

Xamarin in Visual Studio cannot add xamarin.forms from Nuget

I downloaded the xamarin.form project from github. But when I build the project it is missing the xamarin.forms package.
I tried adding it with Nuget but got this error:
Installing 'Xamarin.Forms 1.3.3.6323'.
Successfully installed 'Xamarin.Forms 1.3.3.6323'.
Adding 'Xamarin.Forms 1.3.3.6323' to DialogPro.
Uninstalling 'Xamarin.Forms 1.3.3.6323'.
Successfully uninstalled 'Xamarin.Forms 1.3.3.6323'.
Install failed. Rolling back...
Could not install package 'Xamarin.Forms 1.3.3.6323'. You are trying to install this package into a project that targets 'portable- net45+sl50+MonoAndroid10+xamarinios10+MonoTouch10', 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.##
How can it fix it? Please help me! Thanks.
It looks like you are targeting the wrong profile. You don't have windows phone but you do have silverlight. Do you need silverlight? I know that it definitely works with Profile 78 or 259. Adjust your targets and then try to add the nuget package again. Unfortunately, this means you probably should re-add all of your nugets for that package since the target changed.
edit:
Here's a good article on some of the xamarin supported profiles: http://danrigby.com/2014/04/16/xamarin-pcl-profile-notes/. I forgot that silver light is included. If you open the project in Xamarin Studio, it actually tells you the profile number. Open the csproj in a text editor and see if the profile number is listed at the top.
It sounds like you are adding Xamarin.Forms to a project that doesn't target any of the required frameworks.
You only need to add Xamarin forms package to your android, iOS, WinPhone and PCL projects.

Categories

Resources