Xamarin | Sample Xamarin projects | Form library
kandi X-RAY | Xamarin Summary
kandi X-RAY | Xamarin Summary
Sample Xamarin projects
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Xamarin
Xamarin Key Features
Xamarin Examples and Code Snippets
Community Discussions
Trending Discussions on Xamarin
QUESTION
When I update my windows to windows 11, I notice about when I run the android emulator for my Xamarin project, it freeze and said not responding.
I try these items below but won’t fix my problem :
- reduce ram size of emulator device
- reduce the resolution of emulator device
- reinstall Android SDK
- reinstall visual studio My Virtual Machine Platform and Hyper-V are enabled in my windows features.
My emulator detail is :
...OS: Android 12
Ram: 4GB
Resolution : 1080x2340 pixels
Google Services: true
ANSWER
Answered 2022-Mar-17 at 14:24For the AMD process, we need to make clear to the visual studio that we use the AMD process and it should change the emulator behavior to our process.
First of all like I said we need to make sure the Virtual Machine Platform
and Hyper-V
are enabled because it’s necessary to run an android emulator in a visual studio.
Second, We need to make sure that Android Emulator Hypervisor Driver for AMD Processors
is selected in the visual studio.
Android Emulator Hypervisor Driver for the AMD Processors:
QUESTION
Getting a list of open windows in .Net Framework on Windows was relatively easy. How can I do the same in .Net Core/.Net 5 or later on macOS?
To clarify, I'm looking for a way to retrieve a list of all open windows owned by any running application/process. I don't have much experience of macOS development - I'm a Windows developer - but I've tried to use the NSApplication
as suggested by this answer.
I created a .Net 6.0 Console application in VS2022 on macOS Monterey (12.2), added a reference to Xamarin.Mac
and libxammac.dylib
as described here - which describes doing this in Xamarin rather than .Net, but I don't see any other option to create a Console application. With the simple code:
ANSWER
Answered 2022-Mar-07 at 07:27In the link you refer to, there is an important note:
... as Xamarin.Mac.dll does not run under the .NET Core runtime, it only runs with the Mono runtime.
Because you try to run Xamarin.Mac.dll
under .net-core
, you get this dlopen
error.
No System-wide List via NSApplication
The linked answer with NSApplication.shared.windows is incorrect if you want to read a system-wide list of open windows. It can only be used to determine all currently existing windows for the application from which the call is made, see Apple's documentation.
Alternative solution
Nevertheless, there are several ways to access the Window information in macOS. One of them could be a small unmanaged C-lib that gets the necessary information via CoreFoundation and CoreGraphics and returns it to C# via Platform Invoke (P/Invoke).
Native Code
Here is example code for a C-Lib that determines and returns the names of the window owners.
WindowsListLib.h
QUESTION
When attempting to publish my Xamarin Forms app, I get the following error from Google Play console
We've detected this app uses an unsupported version of Play billing. Please upgrade to Billing Library version 3 or newer to publish this app.
I don't use any billing library. I've tried updating all nuget dependencies, to no luck. How do I fix this error so I can publish my app?
...ANSWER
Answered 2021-Nov-11 at 23:11Apparently I had BILLING
permissions set in my manifest. Removing these fixed the issue.
You can do this by right-clicking the project --> Properties --> Android Manifest --> Searching for BILLING
under "Required Permissions" and unchecking it
Alternatively, open AndroidManifest.xml
and delete the line
QUESTION
I created an appsettings file for a MAUI app and loading it in the IConfiguration using .Host.ConfigureAppConfiguration
on the builder from a MauiApp.CreateBuilder(); I can access the file in Windows but not when running the Android emulator. The code:
ANSWER
Answered 2021-Dec-09 at 02:36There is an open issue Add support for appsetting.json that shows this code snippet as current work-around:
QUESTION
We have Xamarin.Forms solution with iOS and UWP projects. We use Azure pipelines to build the iOS project. Until yesterday everything was working fine. Now the build fails at the NuGet Restore step with the error:
##[error]The nuget command failed with exit code(1) and error(/Users/runner/work/1/s/"MyProjectName.UWP".csproj : error MSB4057: The target "_IsProjectRestoreSupported" does not exist in the project.
We can see that the problem occurs when trying to restore NuGet packages for the UWP project on the Mac OS build host. Image: macOS-11
Workaround will be to exclude it from the solution, but we are using it for testing purposes and this is not a good option for us.
...ANSWER
Answered 2022-Jan-26 at 09:39- Updated Answer This can be resolved using MSBuild task instead, as the collogues mentioned below. However, in my case this still lead to the same error. After investigating the pipeline. The root cause has been identified: Both in MSBuild@1 and XamariniOS@2 tasks you should target the specific iOS Project and not the solution file, like so:
" - task: MSBuild@1 inputs: solution: 'PathToIosProject/myproject.iOS.csproj' configuration: '$(BuildConfiguration)' msbuildArguments: /t:restore
" - task: XamariniOS@2 inputs: solutionFile: PathToIosProject/myproject.iOS.csproj' configuration: '$(BuildConfiguration)' packageApp: true signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
- Old Answer
We have managed to resolve the issue. The root cause of it seems to be an update to the mono framework in the MacOS pipeline build agent. In order to fix it, we need a script for downloading and installing an older version of the mono framework as a first step of the build pipeline like so: link to the pipeline tasks photo
This is the code of the bash scrip used in the task:
#!/bin/bash set -ex
MONO_MACOS_PKG_DOWNLOAD_URL='https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.100.macos10.xamarin.universal.pkg'
mkdir -p /tmp/mono-install cd /tmp/mono-install
mono --version
wget -q -O ./mono-installer.pkg "$MONO_MACOS_PKG_DOWNLOAD_URL"
sudo installer -pkg ./mono-installer.pkg -target /
mono --version
ls -alh /Library/Frameworks/Mono.framework/Versions/Current
QUESTION
I am looking for a preprocessor symbol that would allow me to compile different code based on whether a project is xamarin or not.
...ANSWER
Answered 2021-Dec-19 at 12:15I would suggest you don't use preprocessor symbols, but abstract stuff in separate classes for each platform. Then inject the specific implementation at runtime.
If you really must use these, you can always define your own symbols as needed for each configuration or target framework.
Just create a file called Directory.Build.targets
(casing matters!) in the root of your repo. Usually next to your .sln
file.
In this Directory.Build.targets
you can define symbols like so:
QUESTION
I would like to implement light and dark theme inside of my Maui Blazor application. As you know, Blazor is nothing other than Html and Css so I easily implement dark and light theme for the content of my app (thanks to a simple .dark class added on the html tag).
The problem I am facing is for the upper and lower part of the Maui application.
Let me show you by an example.
Android version
iOS version
The pictures above show you the current situation: on the left, the light theme and on the right, the dark theme. As you can see, the dark theme is problematic for the top and bottom sections (only the top section is problematic for the iOS version).
What I would like to achieve: the top and bottom sections should be colored the same as the content of the page:
- #292929 for the Dark theme
- #FFFFFF for the Light theme
Something like the picture below: when switching to the dark theme, everything is coloured.
I have no idea how to achieve this for Maui Blazor and I have no experience with Xamarin.
Can you point me to the right direction please ?
As you probably know, BlazorWebView enables you to host a Blazor web application right in the .NET MAUI application.
...ANSWER
Answered 2021-Dec-10 at 03:23Within the next month or two, it should become possible to do this via StatusBarEffect
and NavigationBarEffect
in MAUI Community Toolkit. Discussion here - for Xamarin Toolkit.
Those effects are currently in branch xamarin.develop
of Xamarin.Community.Toolkit
. The change will also get merged to Maui Toolkit, not sure when exactly.
Below is based on that source code, adapted to work with MAUI. Tested.
Android:
QUESTION
We are building a mobile app for iOS and Android using Xamarin Forms 5 and using Visual Studio 2022. When we make a Post request to any api, both our own as external api's we are always returned:
Xamarin.PreBuilt.iOS[3728:2199180] Xamarin.iOS: Received unhandled ObjectiveC exception: NSMallocException Failed to grow buffer
GET request work fine. I have searched Google and StackOverflow but can not find any help. I have tried to increase the HttpClient.MaxResponseContentBufferSize without any difference.
The app for now is very simple, one page with a button to test. Code behind is as followed:
...ANSWER
Answered 2021-Dec-01 at 09:02I've had exactly the same problem, and have logged a ticket with Microsoft on the VS feedback forums. And then today I found a simple work-around. At least I assume it's a work-around and not a solution. Where I had
QUESTION
After upgrade my Xamarin.Forms version to 5.0.0.2244, I'm getting the following warning in Main.cs
file inside my iOS project:
ANSWER
Answered 2021-Nov-17 at 20:38Class reference through a string is now deprecated. You need to change this line:
QUESTION
I build xamarin app(uwp,ios,android) and use appCenter for builds and delivery. For certain reason i cant build android and ios project having uwp project included in the solution. Creating build configuration does solve an issue. Is its possible to have some conditional in solution file to include certain projects?
...ANSWER
Answered 2021-Nov-05 at 07:52There is a Nuget restore issue with the latest Mono version. You can try lowering the Mono version, used to build the application in Appcenter. Go to AppCenter -> select Build from the left menu. Then choose a branch. At the most right you will see a setting icon. Click on it. From there menu like this will appear. From the SDK version you can choose a different one.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Xamarin
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page