Forum Xamarin.Android

Cannot find Resource class

RobertWakeland.4316RobertWakeland.4316 USMember, University ✭✭

I am building an Android App in Visual Studio. When I try to build the app referencing items in the Resources folder, I get one of two errors.

If I preface "Resource.Layout." or "Resource.Id." with the namespace for my project, I get this error:

The type or namespace name 'Resource' does not exist in the namespace '' (are you missing an assembly reference?)

If I don't preface the call to Resource with my namespace, it tries to access the default Android.Resource class and I get this error:

'Android.Resource.Layout' does not contain a definition for ''

Has anyone run across this error before? I've been searching for a while and cannot come up with anything that seems to be wrong. The Resource.Designer file exists. I've deleted it and let it get regenerated. The Ids are in the Resource file, the project just doesn't recognize that the resource class is there at all.


  • CheesebaronCheesebaron DKInsider, University mod

    Do you have the word Android in your namespace?

  • RobertWakeland.4316RobertWakeland.4316 USMember, University ✭✭

    Yes. It started out just ending with "Android", but I tried "_Android" and "AndroidApp" as well with no effect.

  • CheesebaronCheesebaron DKInsider, University mod

    Well changing the namespace in your project options won't magically change it for the entire application. You need to change it for all the classes, especially the Resource.Designer.cs file. However, changing the namespace manually without editing the namespace in the project settings will just revert it back to what it was before.

  • RobertWakeland.4316RobertWakeland.4316 USMember, University ✭✭

    It was changed in every file and the project settings for each change.

  • RobertWakeland.4316RobertWakeland.4316 USMember, University ✭✭

    Each change of the namespace was reflected in the Resource.Designer file with a rebuild. The same errors were encountered though.

Sign In or Register to comment.