I'm new to C# and my xamarin forms project won't run. I don't know how to solve this problem, I tried already to change the android target platform, but I can only choose 6.0.
Here is a screenshot of my errors
Screenshot
Open the Android SDK Manager and install Android 7.1. The version of Xamarin you have requires a higher Android target, and once you've installed 7.1 you'll be able choose it in the project properties.
Related
Running C# MAUI for Android/Windows and it build and runs well.
Now, i want to build and run for iOS but get problems.
When installed Visual studio for Mac, XCode on a Mac and using Pair to Mac I get this error:
Error dotnet validation failed, an unexpected error occurred No
receiver was found for topic xvs/idb/initialize-dotnet-sdk
Someone got this problem?
Some details about the setups I have:
My developer computer, Windows 10:
Microsoft Visual Studio Community 2022
Version 17.4.3
VisualStudio.17.Release/17.4.3+33205.214
Microsoft .NET Framework
Version 4.8.04084
...
VisualStudio.Mac 1.0
...
Xamarin 17.4.0.312 (d17-4#be7e8d1)
Visual Studio extension to enable development for Xamarin.iOS and
Xamarin.Android.
...
Xamarin.iOS and Xamarin.Mac SDK 16.1.1.27 (933c6c2c9)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
My Mac, MacOS Monterey 12.6.2
Microsoft Visual Studio for Mac 17.4.2 (Build 17)
...
.NET 6.0.12 (64-bit)
Architecture: X64
...
Apple Developer Tools
Xcode 14.2 (21534)
Build 14C18
...
Xamarin.Mac
Xamarin.Mac not installed. Can't find
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
...
Xamarin.iOS
Xamarin.iOS not installed.
Can't find mtouch or the Version file at
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current.
In my case Visual studio restart helped
What version is your Maui project, .Net 6 or .Net 7? If it is .Net 7. You need to install the latest Visual Studio 2022 for Mac version 17.5 Preview on your Mac. You can also check the following:
1.You can also check whether your Mac is enabled for remote login (open System Preferences and go to the Sharing pane->Check Remote Login in the Service list- >configured to allow access for All users).
2.You can right-click your project and select Properties->iOS->Build->Linker behavior to check whether you have selected Link Framework SDKs Only.
3.According to your error
Xamarin.Mac not installed.
Xamarin.iOS not installed.
You can check whether Xamarin.iOS and Xamarin.Mac are installed on your Mac when installing VS.
For more details, you can refer to the official document:
Installation
Pair to Mac for iOS development
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
I have tried adding the Signalr Client library and the WebApi client package to my Xamarin Solution (on Visual Studio with Xamarin Support and also on Xamarin Studio) but I always get this error although I am able to install other PCLs (for example Microsoft.Net.Http):
Could not install package 'Microsoft.AspNet.WebApi.Client 5.2.3'. You are trying to install this package into a project that targets 'portable-net45+sl50+win+wpa81+wp80+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.
and the following error when adding Signalr:
Adding Microsoft.AspNet.SignalR.Client...
Adding 'Microsoft.AspNet.SignalR.Client 2.2.0' to Corda.Client.
Could not install package 'Microsoft.AspNet.SignalR.Client 2.2.0'. You are trying to install this package into a project that targets 'portable-net45+sl50+win+wpa81+wp80+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.
I have also tried changing the the target framework with not success.
This is the build setting for my project:
and this is my C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks folder:
I get the same errors on both Mac OSX and Windows 10. Any ideas?
Using Profile78 solved my problem. Full explaination here.
A simple workaround that worked with my Xamarin with VS:
Download the dll-files manually here: https://components.xamarin.com/gettingstarted/signalr/true
Import the following into your solution.
Microsoft.AspNet.SignalR.Client.dll
Newtonsoft.Json.dll
System.Net.Http.Extensions.dll
System.Net.Http.Primitives.dll
Done!
The problem is not with the dll-files, but with the (nuget) installer.
The problem is with the nuget package manager,specifically with the Windows Phone 8.1 project. I think it expects it to be a windows phone silverlight 8.1 project. There is a bug on installing signalr client on an universal 8.1 phone project in a xamarin project. It should be sorted out in the next xamarin release. Unselecting windows phone 8.1 in the portable config solves the issue,meaning you will have to take the windows phone 8.1 project out of the xamarin project and your need to create a universal windows 10 project.
Yes, As suggested by others this is the problem from nuget package manager, As per this link it should be fixed with the realease of Microsoft.signalr.client 2.2.1 version but for now if you still want to go with nuget, Add the below nuget source
https://www.myget.org/F/aspnetwebstacknightly/
to visual studio and install pre release version 2.2.1 pre-160523-b816 of the signalr client dll as suggested in below link
https://github.com/SignalR/SignalR/issues/3393
I created a Portable Class Library the other day in VS2013. It targeted the following platforms:
.NET Framework 4.5
Windows 8.1
Windows Phone 8.1 (non-Silverlight)
My question is, can this be used in Xamarin projects such as Xamarin.iOS or Xamarin.Android? I've found a project claiming to support Xamarin, but grepping the solution and project files for "ios" and "android" turn up nothing. If not, what can I do to make my library portable to those platforms?
Thanks.
You need to install Xamarin for Visual Studio first if you haven't already
Open your PCL project and change the target profile to include the Xamarin platforms you want to support. (e.g. Profile 78)
Optionally retarget all your dependencies (projects/nugets)
Recompile your PCLs
You should now have dlls that work also in Xamarin.
You'll have to make your project target those platforms and then recompile your .dlls in order to make them available for Android and iOS.
I don't know what is the edition of your Visual Studio, but the options to target Android/iOS should be available in VS2013. In any case, try downloading Visual Studio 2015 community (which is free), open your project using it and the option should be there.
If none of this works, you can also try manually changing your .csproj file to a different profile. This is stated to have worked on this answer.
When creating a new solution within Xamarian studio I get this error
Could not install package 'Xamarin.Forms 1.0.6186'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5,Profile=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.
Is there a certain version of .Net that Xamarian Forms requires for it to be included in the solution? I've tried searching in their documentation but I'm only seeing marketing and not real in depth documentation.
I had a similar issue using Visual Studio and I've found that the following combination in the PCL works:
.NET Framework 4.5
Windows Phone Silverlight 8
Xamarin.Android
Xamarin.iOS
You have created the wrong project type, you created a normal Windows app, and I assume you are targeting iOS/Android or Mac.
Create the project with the correct type and it should work correctly.
If you are using Xamarin Studio for Windows (without also having Visual Studio installed) you need to download the Portable Library Tools. See the Xamarin doc Introduction to Portable Class Libraries.
I had the same problem with my Xamarin project. The problem was, that in the portable Xamarin project Windows Phone Silverlight was set as target. The PCL project from which I created the nuget, didn't reference Silverlight as target. I don't need Silverlight, so uninstalling all nuget packages from my portable Xamarin project, removing silverlight as target and reinstalling the NuGet packages solved it.
I had similar issue using VS and I found solution here - http://forums.xamarin.com/discussion/29674/xamarin-forms-dll-cannot-be-installed
"It looks like your NuGet Package Manager needs to be upgraded. The Xamarin PCL Profiles are installed but NuGet is not recognising Xamarin.iOS as a target framework. You can update NuGet by selecting Tools - Extensions and Updates, then select the Updates tab, then select Visual Studio Gallery. Then update NuGet from there."
I have invested a lot of time trying all the solutions posted here, but none of them helped me... Here is the solution that worked for me (on Windows 10):
1.) Open your .csproj file
2.) Find the TargetFrameworkProfile entry
3.) This entry contains Profile78 for me, therefore I open the folder below
c:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETPortable/v4.5/Profile/Profile78/SupportedFrameworks
4.a) If the folder does not exist, then use one of the solutions posted here to install the PLC right on your PC
4.b) Unfortunately, ASP.NET and Xamarin don't like each other, therefore delete all ASP profiles from this folder. For me it was ASP.NET Core 5.0.xml. Obviously this will break your ASP.NET support in VS
5.) Restart Xamarin and have fun!
interesting reading about all that:
https://forums.xamarin.com/discussion/52846/cannot-create-new-xamarin-forms-project-pcl-in-xamarin-studio-win10-vs2015