MaxC
MaxC

Reputation: 41

Error "Xamarin.Android.Support.Design 27.0.2.1 is not compatible with monoandroid60"

I am trying to make an app on Visual Studio for my Android phone which runs Android 6.0 Marshmallow.

I compiled the project into an APK file succesfully but my phone failed to parse it so I looked here ( xamarin Visual Studio 2015 apk fails to install: Error "parsing the package" ) and changed my compiler target from Android 8.1 to Android 6.0. I also disabled Shared Mono Runtime.

Visual Studio said I needed to close and then re-open the project for the change so I did it and opening it I got this error:

Severity Code Description Project File Line Suppression State Error NU1202 Package Xamarin.Android.Support.Design 27.0.2.1 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.Design 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1) App1 d:\Xamarin\App1\App1\App1.csproj 1

so I opened NuGet Package Manager and changed the Xamarin.Android.Support.Design package version from 27.0 to 23.0. The error went away but the app preview failed to render and I could only see a black screen with a warning "This project contains resources that were not compiled successfully" but there are no actual warnings in the Error List. How do I fix all this?

Edit: The package built after changing the Xamarin.Android.Support.Design version to 23 is unable to be parsed as well

this is my VS information

Microsoft Visual Studio Community 2017 Version 15.8.5 VisualStudio.15.Release/15.8.5+28010.2036 Microsoft .NET Framework Version 4.7.03062

Installed Version: Community

C# Tools 2.9.0-beta8-63208-01 Common Azure Tools 1.10 Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3) Microsoft JVM Debugger 1.0 Microsoft MI-Based Debugger 1.0 Mono Debugging for Visual Studio 4.11.11-pre (8fb558f) NuGet Package Manager 4.6.0 ProjectServicesPackage Extension 1.0 ResourcePackage Extension 1.0 ResourcePackage Extension 1.0 Visual Basic Tools 2.9.0-beta8-63208-01 Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: Visual Studio Code Debug Adapter Host Package 1.0Xamarin 4.11.0.776 (d15-8@1ae9b59d7) Xamarin Designer 4.15.9 (d000f568b) Xamarin Templates 1.1.116 (9619170) Xamarin.Android SDK 9.0.0.19 (HEAD/a8a3b0ec7) Xamarin.Android Reference Assemblies and MSBuild support.

Upvotes: 2

Views: 4304

Answers (1)

MaxC
MaxC

Reputation: 41

I figured it out. The solution is to change the Xamarin.Android.Support.Design package to 23.0 and change your AndroidManifest.Xml and other code to remove attributes/implementations of classes which are not in your targeted platform API level range (in my case, Android 6.0 API level 23 - Android 5.0 API level 21). See: https://developer.android.com/reference/ https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels

In order to fix the package parsing error you need to sign your app through the Visual Studio distribution wizard. See: https://learn.microsoft.com/en-us/xamarin/android/deploy-test/signing/?tabs=vswin

I hope this helps someone else.

Upvotes: 2

Related Questions