Change Target Android Version

PbartPbart Member ✭✭

I am trying to change the target android version of my project to 8.1. However, when I do this, I get an error saying that "Your project does not reference "MonoAndroid,Version=v8.1" framework. Add a reference to "MonoAndroid,Version=v8.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore."

I checked the Android project file and I see that the target version has changed to v8.1
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>

And when I do a Nuget Restore I get a notification that there was nothing to restore

I have taken a look at other people's suggestions and none of them are working but I figured I would ask to see if anyone can provide tips or suggestions to this problem

Best Answer

  • PbartPbart ✭✭
    Accepted Answer

    At the end of the day I got too annoyed at this issue and just migrated all my code to a new Xamarin project set to my targeted android framework and it now works fine.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Please open the AndroidManifest.xml check the <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" /> if the android:targetSdkVersion set to 27 explicitly.

  • PbartPbart Member ✭✭

    I have verified that the android:targetSdkVersion is set to 27 but I have android:minSdkVersion set to 15. Does it matter if I set the minimum target to 21?

  • PbartPbart Member ✭✭

    I went ahead and changed my the android:minSdkVersion to 21 and still had the same issue.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can see this link, dinob set the target framework to use the latest installed platform(8.1), he will get same error , but set the target framework to Android 8.1(Oreo) , this issue is gone, you can refer to it.https://forums.xamarin.com/discussion/137371/your-project-is-not-referencing-the-mono-android-version-v8-1-framework-error

  • PbartPbart Member ✭✭
    Accepted Answer

    At the end of the day I got too annoyed at this issue and just migrated all my code to a new Xamarin project set to my targeted android framework and it now works fine.

Sign In or Register to comment.