Xamarin Android Quickstart fails with "namespace 'Content' not found"

Tim Reynolds 106 Reputation points

Trying to build a Sample / Quick Android app for Xamarin.
When it tries to build, I get an error in my MainActivity
"The type or namespace name 'Content' does not exist in the namespace 'MY NAME SPACE' are you missing an assembly reference?"
pointing to:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)

This is the default app, prior to me making ANY changes to it.

These are the steps I have tried.

  • https://learn.microsoft.com/en-us/xamarin/get-started/first-app/?pivots=windows
  • After that failed, i did this
  • Totally uninstalled everything that "Tools>Android>Android SDK Manager" said was intalled.
  • I deleted my project folder
  • I rebooted my laptop
  • I created a new Xamarin Android project in VS
  • It failed, stating that I did not have aapt installed
  • I followed all of the guidance which suggested running an android.bat file - this failed saying it was obsolete
  • I manually installed the SDK and appropriate tools (see final versions below)
  • I still get the same errors.


Visual Studio 2019 v 16.8.3
Xamarin v
Xamarin.Android SDK v
Android SDK Platform 28 and 29
Android Platform Tools 30.0.4
Android SDK Build Tools 29.0.2
Android Emulator 30.0.6
Android SDK Tools 26.1.1
SDK Patch Applier v4

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,156 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tim Reynolds 106 Reputation points

    The issue was that my project namespace was Company.Prototype.Android and something was getting confused trying to find Android.Content.PM.Permissions. I changed my namespace to Company.Prototype.PhoneApp and it now compiles.

    2 people found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Charles Winters 6 Reputation points

    I found there is a similar problem with ApplicationName.Mobile. I'm thinking MS's example should have a fully qualified namespace to avoid all of this.

    1 person found this answer helpful.
    0 comments No comments

  2. Siamak Shamaee 0 Reputation points

    It's a bit funny. I got the same error because I called my solution Xamarin.Exercise.
    Once I changed it to Exercise only it started to work

    0 comments No comments