Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error CS0246 The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly reference?)

Please have a look at the packages I have in my Xamarin.Forms project.

enter image description here

Suddenly, without any changes, I started to get the shown error. I got similar issue one time and fixed by updating the packages. But right now, all the packages are up-to-date.

enter image description here

like image 352
Rauf Avatar asked Oct 26 '25 09:10

Rauf


2 Answers

I have re-added reference for Mono.Android.dll from the location C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v11.0.

When I moved the location of the project, I guess the reference was broken.

like image 192
Rauf Avatar answered Oct 28 '25 00:10

Rauf


I found that if you look in the .csproj file for Mono.Android.dll you will fine a path with multiple ../../ in the path. I do not k now why this type of path is used but for me it really messed up everything. This is an issue every time you change where the project/solution resides.

like image 21
Joe K Avatar answered Oct 27 '25 23:10

Joe K