xamarin-android | Android provides open-source bindings | Android library
kandi X-RAY | xamarin-android Summary
kandi X-RAY | xamarin-android Summary
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#.
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-android
xamarin-android Key Features
xamarin-android Examples and Code Snippets
Community Discussions
Trending Discussions on xamarin-android
QUESTION
This is a sample application attempting the Xamarin Forms navigation capability. We have an event handler with this simple logic:
...ANSWER
Answered 2022-Apr-11 at 05:40It looks like you don’t have a Shell, so Shell.Current is null. What Shell example did you follow?
MainPage = new MainPage();
means your app is pointing to a page of type MainPage. To use Shell (Route) navigation, it needs to be pointing to a Shell.
I would expect to see MainPage = new AppShell();
.
There may be other details missing, so be sure to follow a working example, such as Xaminals.
The new AppShell line can be seen in https://github.com/xamarin/xamarin-forms-samples/blob/main/UserInterface/Xaminals/Xaminals/App.xaml.cs.
Note: Its possible to navigate in Xamarin Forms without having Shell, nor defining routes. (Personally, I dislike the Shell, so I don’t use it.) You can define MainPage as a NavigationPage (see its doc). Or you can simply set App.MainPage to different pages, to move between them, without a navigation stack.
QUESTION
I have an Application that use Xamarin.FireBase.Messaging, and it works on all <12 android version.
When I try to buil my App in Android 12 it apears this error:
"*Severity Code Description Project File Line Suppression State Error ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl254956208.tmp/base.apk (at Binary XML file line #40): crc64bb777672d9471d38.CustomFirebaseMessagingService: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present] at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:line 357 at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at AndroidDeviceExtensions.d__12.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:line 206 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at AndroidDeviceExtensions.d__12.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:line 223 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Xamarin.Android.Tasks.FastDeploy.d__105.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 339 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Xamarin.Android.Tasks.FastDeploy.d__105.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 356 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Xamarin.Android.Tasks.FastDeploy.d__100.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 213 0 *"
I think that I add all the Attributes "android:exported".
This is my manifest:
...ANSWER
Answered 2022-Mar-28 at 02:35I had created a simple to test your code. When I deleted the (Exported = false)
, I will meet the same error as yours. But if I used the [Service(Exported = false)]
, the project worked well.
So the problem shouldn't appear. But you can try to declare the service in the manifest.xml. Such as:
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
I want to create a GUI in C# that will be used to run keytool on cmd.exe
behind the scenes to create a keystore, including a key, and certificate data.
Input data then requires
- Keystore path
- Password
- Key alias
- Key password
- Validity
- Certificate info (cn, ou, o, l, st and c)
Unfortunately people may type special characters in their passwords and also space is allowed in the certificate info.
Overall I am worried someone may input some information somewhere that can result in a disastrous command running behind the scenes once this is called (like rm -rf *
).
Is there a way to pass a java properties file with the input information to keytool or is there any way that I can safely escape all the data that is passed as string parameters to keytool?
I could not find any type of file that keytool could take, even in separate steps, that would eliminate this issue.
here's the unsafe code (warning: IT'S UNSAFE!!):
...ANSWER
Answered 2022-Feb-18 at 23:39I believe that invoking the keytool
binary directly instead of cmd.exe
would do the trick if you don't want the user to inject shell commands.
QUESTION
I'm kinda new to xamarin. I got this error when I'm switching from debug mode to release mode, I search everywhere but I got no answer.
...ANSWER
Answered 2021-Sep-03 at 21:04Turning linking off is the lazy answer. The point of using the linker is to remove "dead" code and minimize the size of the program. The size of a mobile app is more important to many users.
The linker used in Xamarin.Android is going to remove code it thinks you are not using. This is especially true when using reflection. To fix this you would need to tell the compiler you're using the type.
A popular solution is to use a LinkerPleaseInclude.cs
file and make stub methods using the type and properties so the compiler thinks you're using them. You will find many examples on the Internet.
QUESTION
How would I create a Xamarin.Android
project that targets .NET 6 (Xamarin.Android being the traditional Android bindings, not .NET MAUI)?
Creating a new project from the Visual Studio 2022 UI generates the same Mono template Visual Studio 2019 does.
This guide seems to suggest manually editing the .csproj file, but doing that breaks the build with errors like:
...Package Xamarin.AndroidX.AppCompat 1.3.1.3 is not compatible with monoandroid50 (MonoAndroid,Version=v5.0)
ANSWER
Answered 2022-Feb-14 at 08:32Upgrade your Visual Studio to Visual Studio 2022 preview.
Version: Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.1.0 Preview 4.0
After that you could create Android project with .Net 6.0.
QUESTION
Error only occurs when compiling on release mode... on debug mode the compiling occurs without problem... can you help me?
This is the stack trace for error...
...ANSWER
Answered 2022-Feb-02 at 22:41What your linker settings? Please change it to None, then release it, if you will get the same exception,then please share Android option screenshot that contains all the settings when release. No Dex compiler was specified, select D8 Dex compiler in the Android project properties => android options => dex compiler D8 Code :
d8
QUESTION
When I attach pdf and doc files using Recent files I'm getting the following exception. Can anyone help on this. Working fine when i attach image file using Recent files please help on this I m new to this Xamarin forms.
Thanks in advance.
...ANSWER
Answered 2021-Dec-13 at 02:06Yes, from Xamarin.Plugin.FilePicker,we know that :
This package has been deprecated as it is legacy and is no longer maintained.
Just as SushiHangover said, you can use Xamarin.Essentials: File Picker to achieve this.
The FilePicker
class lets a user pick a single or multiple files from the device.
FilePicker.PickAsync()
method enables your user to pick a file from the device. You are able to specific different PickOptions
when calling the method enabling you to specify the title to display and the file types the user is allowed to pick. By default.
You can refer to the following sample code:
QUESTION
I'm trying to write my first cross platform app in Xamarin using mvvm. The app records items (payments) inserted by the user and does some stuff (previsions and other math).
I wrote the code to add/update/delete/show items and when a item is added the app save the item writing a file with a custom extension (*.dinero
) that contains all information about the item, so asynchronously the app load all files at the start.
I embedded a function that send by email these files in order to allow to another user to add the same item to its items list.
My question is how can I associate the the custom file extension to my app and how implement a procedure that open the "newItempage" to allow the user to save the item to its files?
I found the question Associate file extension with Xamarin Android application but I can't understand how to use it (where i have to write the code reported in the answer).
...ANSWER
Answered 2021-Nov-23 at 15:06I Answer my question in order to make others life a little simple.
To associate files with the app that allow to start the app when the event "tap on a file with custom extension" occurs we have to add in the MainActivity.cs
above the class declariation:
QUESTION
I would love to add a widget to my Android app, which is being developed using Uno Platform.
I found some tutorials how to do it in Xamarin, but don't know if it will work.
One of the tutorials: https://marcofolio.net/app-widget-xamarin-android/
Thanks!
...ANSWER
Answered 2021-Oct-03 at 15:16Uno Platform on Android is based on vanilla Xamarin, and you'll be able to use everything that Xamarin provides.
You'll need to place your android-specific code in your .Android
head project (not in the shared project), and the use #if __ANDROID__
blocks to ensure that the android specific code is only used on the android target.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xamarin-android
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