简体   繁体   中英

Resource.layout/Id not found in Android Xamarin

I have a big Xamarin Android project where I recently added few new layout files. Ever since I added them, the build always failed with Resource.Id not found errors (complaining about not being able to find the UI components' ids, even though they are there, there are NO spelling mistakes). I tried cleaning and rebuilding, deleting bin and obj folders and cleaning & rebuilding, adding "MSBuild:UpdateGeneratedFiles" to properties of the project and then closing VS, cleaning & rebuilding - none of that worked. Since the errors were saying the UI components' ids were not found, these UI elements weren't included in Resource.Designer.cs file, so I figured that is the issue. I tried deleting Resource.Designer.cs file and rebuilding, and it got updated and included the missing UI components, but the issue is still there. I am kind of blocked at this point, any help would be much appreciated...

The errors look like this:

Error   CS0117  'Resource.Layout' does not contain a definition for 'layout_exceptionfooter'    BrockSolutions.SmartClear.GateScanning.MobileClient.Android C:\git\SmartSuite\SmartClear\Libraries\GateScanning.MobileClient.Android\Components\PassengerScanExceptionFooterComponent.cs    25  Active

enter code here

At first, check these layout files is in the layout folder which belongs to the Resources folder.

And then, check the file properties of them and make sure that the Build Action is set as AndroidResource. You can check it by right click the file and click the properties.

Finally, if your project is in a xamarin.forms project, please check the namespace of the.cs file.

If the problem still exists, you can post the code you used the layout files and an example of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM