Search code examples
androidvisual-studio-app-center

AppCenter Build: error CS0103: The name 'Android' does not exist in the current context


I have a problem with the AppCenter Build service. I am building Xamarin.Forms project and it this shows error on all line, Where I used Android namespace.

error CS0103: The name 'Android' does not exist in the current context

I use full path for classes, not "using" I use a command like this Android.OS.Enveironment . . . . and this causes that errors.

Any Solution?


Solution

  • In my case, it was because I was referencing Mono.Android in a .Net Standard project, which works well, but is not recognised as an Android project by AppCenter (bug?) hence AppCenter does not know it has to use its own Mono.Android lib to build the project(s).

    I resolved this by choosing Android Library as template for my projects that need Mono.Android.

    enter image description here