I want to know how to create a Xamarin.Forms Project that targets minimum version of Android Kitkat (API 19), without using the Shared Project option.
.Net Standard Library is not an option since the minimum supported Android version is Nougat. A large percentage of my target users (more than 40%) still uses phones with an Android version lower than Nougat.
In Visual Studio 15.5.1 or greater, no PCL option is provided under the Code Sharing Strategy Section in creating a new Xamarin.Forms project when using the Cross-Platform App template.
It was noted that PCL is now deprecated on Xamarin's Forum and also on the Visual Studio Developer Community
Key Supporting Questions:
OR Visual Studio 2017 (Community, Professional, or Enterprise edition). Visual Studio 2017 version 15.7 or later is required. Visual Studio Tools for Xamarin version 4.10.0 or later (installed as part of the Mobile development with .NETworkload).
To get started with Xamarin apps development, download Visual Studio 2017 and install it on your windows machine. The VS 2017 is compatible with Windows7 SP1, 8, 8.1 and Windows 10. You can download it at Visual Studio 2017. I have installed it on Windows 10. Visual Studio 2017 is a lightweight IDE than ever!
Visual Studio 2017 version 15.7 or later is required. Visual Studio Tools for Xamarin version 4.10.0 or later (installed as part of the Mobile development with .NET workload). The Xamarin Android SDK Manager also requires the Java Development Kit (which is automatically installed with Xamarin.Android).
With Visual Studio 2017, any Xamarin.Forms XAML page now supports improved IntelliSense experience for code completion, bindings, custom properties, custom controls, converters, and much more. In Visual Studio, create a new Blank App (Xamarin.Forms Portable) solution and name it XamarinFormsApp.
Forms supports Android 4.0.3 (API 15) and higher, you are confusing the "Target Framework" (compileSdkVersion
) for the "Target Android Version" ( targetSdkVersion
) vs the "Minimum Android Version" (minSdkVersion
).
Your Xamarin.Form
project has to use the target framework of Nougat/7.0 (MonoAndroid7.0
) or above but can target the minimum of 4.0.3/IceCreamSandwich version.
Xamarin has a great guide that explains how those things relate from Android to Xamarin.Android
Microsoft completely removed the template option to create PCL-based libraries
PCL projects still build fine
NetStandard is the only future, PCLs are dead, etc, etc...
IMHO this was breaking change as a lot of my clients are not ready to convert to NetStd and there are still NetStd bugs floating around (edge cases mostly)
Still need to create a PCL library, grab an existing project and copy, strip and rename it... or create the .csproj
yourself (see basic .csproj
).
.csproj
:<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C38DBA87-39CB-4FD5-B409-6D19E6ED54C8}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UseMSBuildEngine>true</UseMSBuildEngine>
<OutputType>Library</OutputType>
<RootNamespace>PCLTemplate</RootNamespace>
<AssemblyName>PCLTemplate</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="MyClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With