Bug 6155 - Layout with the name of Void.axml
Summary: Layout with the name of Void.axml
Status: RESOLVED UPSTREAM
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-07-17 10:30 UTC by Tracy
Modified: 2016-08-03 15:24 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Tracy 2012-07-17 10:30:34 UTC
You are unable to name a Layout with the name Void.axml.
It will let you make the file, work on it, etc.
When you go to build your project it will fail.
Simply renaming the file to something else corrects the problem.
Comment 1 Jonathan Pryor 2012-07-17 15:21:39 UTC
This is an Android "bug." The Android SDK tool `aapt` is used to compile resources, and `aapt` is generating the error message:

    res/layout/void.axml:0: error: invalid symbol: 'void'

The same thing happens with a Java project if you attempt to have a e.g. res/layout/void.xml file.

The underlying reason for this is that all Resource filenames are turned into integer constant fields where the field name has the same name as the filename. `void` is a Java keyword, and Java has no ability to escape keywords. If `aapt` didn't prevent res/layout/void.xml, then `aapt` will attempt to generate the following R.java file:

    public class R {
        public static class layout {
            public static final int void = ...
        }
    }

There is no way for the above to ever compile in Java. The same thing happens if you attempt to create any Resource file with a basename equal to a Java keyword, e.g. `int`, `class`, etc.