How to create xamarin android project targeting specific android version? - xamarin

How to create android project targeting specific android version e.g. v5.0?
it seems when creating new project it is auto picking latest installed target sdk version
it seems they forgot to add those options

This is a part of Android manifest that is available as part of the project properties.

Related

TargetFrameworkVersion problem of Xamarin.Form.Android

I am a beginner at Xamarin.Forms.
My project has to support Android 6 and I create a brand new project with Xamarin.Forms 4.8.0.1451, and then set the Compile using Android version to Android 6.
Now visual Studio reports this error:
Severity Code Description Project File Line Suppression State
Error The $(TargetFrameworkVersion) for Sample.Android (v6.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion) for Sample.Android. Sample.Android
It seems the current version Xamarin.Forms does not support Android 6, right?
How can I solve this? Whether I can only use a lower version Xamarin.Forms?
Thank you.
First the Target Framework (also known as compileSdkVersion) is the specific Android framework version (API level) that your app is compiled for at build time. This setting specifies what APIs your app expects to use when it runs, but it has no effect on which APIs are actually available to your app when it is installed. As a result, changing the Target Framework setting does not change runtime behavior.
The Target Framework identifies which library versions your application is linked against – this setting determines which APIs you can use in your app. For example, if you want to use the some method that was introduced in Android 6.0, you must set the Target Framework to API Level 23 or later.
We recommend that you always compile with the latest available Target Framework version.
So you don't need to set the Compile using Android version to Android 6,if you want it support Android 6,you just need set the Target Android Version or Minimum Android Version to android 6.
And you could see the Android version(MonoAndroid Version) that Xamarin.Forms depends on when you open the NugetPackage Manager.

Xamarin - How to update Mono.Android version to resolve dependencies?

I'm trying to install a nuget package (Xamarin.Firebase.Firestore) which requires a newer version of Xamarin.GooglePlayServices.Basement (60.1142.0, I have 42.1021.1), which in turn requires me to update the xamarin.android.support packages. When I try to update those, I get this error
"Package Xamarin.Android.Support.Design 27.0.2 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.Design 27.0.2 supports: monoandroid81 (MonoAndroid,Version=v8.1)"
I've tried changing my target android version to 8.1, I've also updated my SDK as well as the build tools. I'm running Visual Studio 15.6.1. As a last ditch effort, I tried deleting the Mono.Android V8.0 reference and then adding a new reference to V8.1, but whenever I do so, Visual studio just ends up adding the reference with the path pointing to V8.0, even though the reference I added was clearly pointing to V8.1.
Anyone has a clue how to resolve this issue?
tried changing my target android version to 8.1
You need to change the Target Framework that is used to compile your android application, not the Target Android version (but assumably you would set these two to the same, read the Understanding Android API Levels link below.
Visual Studio for Windows:
Visual Studio for Mac:
Target Framework – Specifies which framework to use in building your application. This API level is used at compile time by Xamarin.Android.
Minimum Android Version – Specifies the oldest Android version that you want your app to support. This API level is used at run time by Android.
Target Android Version – Specifies the version of Android that your app is intended to run on. This API level is used at run time by Android.
Understanding Android API Levels
Manifest Entries:
Visual Studio for Windows:
Visual Studio for Mac:

MvvmCross.Forms 5.4: How to setup UWP project?

I started a new Xamarin project and installed the MvvmCross.Forms.StarterPack 5.4 NuGet. All of the projects were changed to support the MvvmCross framework except for the UWP project. What do I need to add to the UWP project so that it will build and run?
MvvmCross has a playground project setup for UWP, https://github.com/MvvmCross/MvvmCross/tree/develop/TestProjects/Playground/Playground.Forms.Uwp. Maybe you can follow it to set it up manually.

How to change default target Android API?

When I create a new Xamarin Android Application in Visual Studio for Mac, it uses the Automatic Target Android version of API10. Havoc ensues shortly after creating the project as Nuget packages such as Xamarin.Android.Support.v4 23.1.1 fail to install. How do I change the "Automatic" version used in the project template?
For example: In Visual Studio (Mac) I go File > New Project > Android App > Modern Development (API 16) > Create. When the project is created, I right click the project > Android Application. The Minimum Android version is API 16 but the Target Android version is 10. I want the Target to be the latest Android API installed (API 25). How do I do that?

Can not compile after migrating unified api in xamarin forms

We have migrated the xamarin forms project to unified api.
But we have the strange compile error like this:
Could not AOT the assembly '.../iOS/obj/iPhone/Debug/mtouch-cache/Build/Xamarin.Forms.Labs.dll
So I changed the settings in iOS project's options.
In ios Build Tab of Project options(iOS) I changed the "don't link" to "Link all assemblies".
But the app is crashed when it is started.
xamarin version is 5.7.1(build 17).
xamarin forms's version is 1.3.5.6337.
xamarin forms labs's version is 1.0.1.5.
Please help me if you have the experience with this error.
Replace Xamarin.Forms.Labs with XLabs.Forms.
There has been a major refactoring on how the XLabs project is structured so your existing project based on the 1.x.x will break. The reason for the refactoring was simple; separate functionality that does not depend on Xamarin.Forms into different assemblies. This allows the use of functionality like IoC, Serialization and even platform specific services without referencing XF.
To upgrade:
Uninstall any existing Xamarin.Forms.Labs packages from your
project.
Install XLabs.Forms package to your projects (PCL, iOS, Droid & WP). This will update Xamarin.Forms to the latest stable release (1.4.x)
Refactor code to reference the correct namespaces.

Resources