Hundreds of errors in Resource.Designer.cs with new Android project on Xamarin.Forms 2.2.0.45

JonHuntJonHunt USMember ✭✭

I have a new Xamarin Forms solution setup with a PCL, an iOS app (which builds fine), and an Android project. The Android project is up to date with the latest Nuget packages for Xamarin Forms (2.2.0.45) to match the PCL project. However when I build the project I'm getting over 500 errors in the Resource.Designer.cs file.

I've tried all the suggestions that I've found online, such as deleting the file and having it regenerated during the Build. Checking the .csproj file for the tag and it's there.

Xamarin Forums don't have any answers, some people have filed bug reports. I can't imagine having a clean new Android project on Xamarin Forms won't build. The PCL and iOS app are running fine and have no errors.

Example build output looks like this:

1>C:\MyApp\Droid\Resources\Resource.Designer.cs(39,124,39,130): error CS0117: 'Resource.Animation' does not contain a definition for 'fab_in' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(40,125,40,132): error CS0117: 'Resource.Animation' does not contain a definition for 'fab_out' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(41,129,41,140): error CS0117: 'Resource.Animation' does not contain a definition for 'snackbar_in' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(42,130,42,142): error CS0117: 'Resource.Animation' does not contain a definition for 'snackbar_out' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(87,125,87,132): error CS0117: 'Resource.Attribute' does not contain a definition for 'barSize' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(125,145,125,172): error CS0117: 'Resource.Attribute' does not contain a definition for 'disableChildrenWhenDisabled'
1>C:\MyApp\Droid\Resources\Resource.Designer.cs(192,136,192,154): error CS0117: 'Resource.Attribute' does not contain a definition for 'middleBarArrowSize'
1>C:\MyApp\Droid\Resources\Resource.Designer.cs(204,133,204,148): error CS0117: 'Resource.Attribute' does not contain a definition for 'popupPromptView'
1>C:\MyApp\Droid\Resources\Resource.Designer.cs(211,124,211,130): error CS0117: 'Resource.Attribute' does not contain a definition for 'prompt' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(228,129,228,140): error CS0117: 'Resource.Attribute' does not contain a definition for 'spinnerMode' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(282,139,282,160): error CS0117: 'Resource.Attribute' does not contain a definition for 'topBottomBarArrowSize'
1>C:\MyApp\Droid\Resources\Resource.Designer.cs(337,121,337,132): error CS0117: 'Resource.Color' does not contain a definition for 'error_color'

Best Answer

Answers

  • JulienRosenJulienRosen CAMember ✭✭✭✭
    edited June 2016

    You are using some third party stuff that has not been updated to the latest android specs. Most likely culprit is XLabs. Or perhaps you have not updated your android SDK in a while.

  • TonyDTonyD USMember ✭✭✭

    Under Android SDK Manager (Tools menu), make sure you have the latest versions (>= 23).

    And as @JulienRosen said, you need to get the latest nugets and I know I had to recompile XLabs from scratch with the new support libraries for it to work.

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @JonHunt - just adding another thing here, make sure you haven't upgrade the Android Support Libraries as they are normally further ahead than what Xamarin Forms uses. If you have upgraded them, uninstall all Nuget packages in the Android project including Xamarin Forms, then just install Xamarin Forms, it will automatically add the Support Libraries to the correct version.

  • ClowningClowning USMember ✭✭

    Hey, i has the same problem...

    **Add a new file into Android Project ( At root )

    Create a file "Resources.cs"

    And add this code : **

    using System;

    namespace .Droid
    {
    public partial class Resource
    {
    public partial class Attribute
    {
    // public const int mediaRoutePlayDrawable = -1;
    public const int mediaRouteSettingsDrawable = -2;
    }

    public partial class Color
    {
        public const int design_textinput_error_color = -1;
    }
    
    public partial class Dimension 
    {
        public const int design_fab_content_size = -1;
        public const int design_navigation_padding_top_default = -1;
    
        public const int design_tab_min_width = -1;
        public const int dialog_fixed_height_major = -1;
        public const int dialog_fixed_height_minor = -1;
        public const int dialog_fixed_width_major = -1;
        public const int dialog_fixed_width_minor = -1;
        public const int mr_media_route_controller_art_max_height = -1;
    }
    
    public partial class Drawable 
    {
        public const int ic_setting_dark = -1;
        public const int ic_setting_light = -1;
        public const int mr_ic_settings_dark = -1;
        public const int mr_ic_settings_light = -1;                       
    }
    
    public partial class Id
    {
        public const int art = -1;
        public const int buttons = -1;
        public const int default_control_frame = -1;
        public const int media_route_control_frame = -1;
        public const int media_route_list = -1;
        public const int media_route_volume_layout = -1;
        public const int media_route_volume_slider = -1;
        public const int play_pause = -1;
        public const int route_name = -1;
        public const int settings = -1;
    
        public const int stop = -1;
        public const int subtitle = -1;
        public const int title_bar = -1;
        public const int disconnect = -1;
    }
    
    public partial class Layout
    {
        public const int mr_media_route_chooser_dialog = -1;
        public const int mr_media_route_controller_material_dialog_b = -1;
        public const int mr_media_route_list_item = -1;
    }
    
    public partial class String
    {
        public const int mr_media_route_chooser_dialog = -1;
        public const int mr_media_route_controller_material_dialog_b = -1;
        public const int mr_media_route_list_item = -1;
    
        public const int mr_media_route_button_content_description = -1;
        public const int mr_media_route_chooser_searching = -1;
        public const int mr_media_route_chooser_title = -1;
        public const int mr_media_route_controller_disconnect = -1;
        public const int mr_media_route_controller_no_info_available = -1;
        public const int mr_media_route_controller_pause = -1;
        public const int mr_media_route_controller_play = -1;
        public const int mr_media_route_controller_settings_description = -1;
        public const int mr_media_route_controller_stop = -1;
        //public const int ApplicationName = -1;
        //public const int Hello = -1;
    
    }
    
    public partial class Style
    {
        public const int RtlOverlay_Widget_AppCompat_ActionButton_Overflow = -1;
    
    }
    
    public partial class Styleable
    {
        public const int FloatingActionButton_android_background = -1;
        public const int[] Theme = null;
        public const int Theme_actionBarDivider = -1;
        public const int Theme_actionBarItemBackground = -1;
        public const int Theme_actionBarPopupTheme = -1;
        public const int Theme_actionBarSize = -1;
        public const int Theme_actionBarSplitStyle = -1;
        public const int Theme_actionBarStyle = -1;
        public const int Theme_actionBarTabBarStyle = -1;
        public const int Theme_actionBarTabStyle = -1;
        public const int Theme_actionBarTabTextStyle = -1;
        public const int Theme_actionBarTheme = -1;
        public const int Theme_actionBarWidgetTheme = -1;
        public const int Theme_actionButtonStyle = -1;
        public const int Theme_actionDropDownStyle = -1;
        public const int Theme_actionMenuTextAppearance = -1;
        public const int Theme_actionMenuTextColor = -1;
        public const int Theme_actionModeBackground = -1;
        public const int Theme_actionModeCloseButtonStyle = -1;
        public const int Theme_actionModeCloseDrawable = -1;
        public const int Theme_actionModeCopyDrawable = -1;
        public const int Theme_actionModeCutDrawable = -1;
        public const int Theme_actionModeFindDrawable = -1;
        public const int Theme_actionModePasteDrawable = -1;
        public const int Theme_actionModePopupWindowStyle = -1;
        public const int Theme_actionModeSelectAllDrawable = -1;
        public const int Theme_actionModeShareDrawable = -1;
        public const int Theme_actionModeSplitBackground = -1;
        public const int Theme_actionModeStyle = -1;
        public const int Theme_actionModeWebSearchDrawable = -1;
        public const int Theme_actionOverflowButtonStyle = -1;
        public const int Theme_actionOverflowMenuStyle = -1;
        public const int Theme_activityChooserViewStyle = -1;
        public const int Theme_alertDialogButtonGroupStyle = -1;
        public const int Theme_alertDialogCenterButtons = -1;
        public const int Theme_alertDialogStyle = -1;
        public const int Theme_alertDialogTheme = -1;
        public const int Theme_android_windowAnimationStyle = -1;
        public const int Theme_android_windowIsFloating = -1;
        public const int Theme_autoCompleteTextViewStyle = -1;
        public const int Theme_borderlessButtonStyle = -1;
        public const int Theme_buttonBarButtonStyle = -1;
        public const int Theme_buttonBarNegativeButtonStyle = -1;
        public const int Theme_buttonBarNeutralButtonStyle = -1;
        public const int Theme_buttonBarPositiveButtonStyle = -1;
        public const int Theme_buttonBarStyle = -1;
        public const int Theme_buttonStyle = -1;
        public const int Theme_buttonStyleSmall = -1;
        public const int Theme_checkboxStyle = -1;
        public const int Theme_checkedTextViewStyle = -1;
        public const int Theme_colorAccent = -1;
        public const int Theme_colorButtonNormal = -1;
        public const int Theme_colorControlActivated = -1;
        public const int Theme_colorControlHighlight = -1;
        public const int Theme_colorControlNormal = -1;
        public const int Theme_colorPrimary = -1;
        public const int Theme_colorPrimaryDark = -1;
        public const int Theme_colorSwitchThumbNormal = -1;
        public const int Theme_controlBackground = -1;
        public const int Theme_dialogPreferredPadding = -1;
        public const int Theme_dialogTheme = -1;
        public const int Theme_dividerHorizontal = -1;
        public const int Theme_dividerVertical = -1;
        public const int Theme_dropDownListViewStyle = -1;
        public const int Theme_dropdownListPreferredItemHeight = -1;
        public const int Theme_editTextBackground = -1;
        public const int Theme_editTextColor = -1;
        public const int Theme_editTextStyle = -1;
        public const int Theme_homeAsUpIndicator = -1;
        public const int Theme_listChoiceBackgroundIndicator = -1;
        public const int Theme_listDividerAlertDialog = -1;
        public const int Theme_listPopupWindowStyle = -1;
        public const int Theme_listPreferredItemHeight = -1;
        public const int Theme_listPreferredItemHeightLarge = -1;
        public const int Theme_listPreferredItemHeightSmall = -1;
        public const int Theme_listPreferredItemPaddingLeft = -1;
        public const int Theme_listPreferredItemPaddingRight = -1;
        public const int Theme_panelBackground = -1;
        public const int Theme_panelMenuListTheme = -1;
        public const int Theme_panelMenuListWidth = -1;
        public const int Theme_popupMenuStyle = -1;
        public const int Theme_popupWindowStyle = -1;
        public const int Theme_radioButtonStyle = -1;
        public const int Theme_ratingBarStyle = -1;
        public const int Theme_searchViewStyle = -1;
        public const int Theme_selectableItemBackground = -1;
        public const int Theme_selectableItemBackgroundBorderless = -1;
        public const int Theme_spinnerDropDownItemStyle = -1;
        public const int Theme_spinnerStyle = -1;
        public const int Theme_switchStyle = -1;
        public const int Theme_textAppearanceLargePopupMenu = -1;
        public const int Theme_textAppearanceListItem = -1;
        public const int Theme_textAppearanceListItemSmall = -1;
        public const int Theme_textAppearanceSearchResultSubtitle = -1;
        public const int Theme_textAppearanceSearchResultTitle = -1;
        public const int Theme_textAppearanceSmallPopupMenu = -1;
        public const int Theme_textColorAlertDialogListItem = -1;
        public const int Theme_textColorSearchUrl = -1;
        public const int Theme_toolbarNavigationButtonStyle = -1;
        public const int Theme_toolbarStyle = -1;
        public const int Theme_windowActionBar = -1;
        public const int Theme_windowActionBarOverlay = -1;
        public const int Theme_windowActionModeOverlay = -1;
        public const int Theme_windowFixedHeightMajor = -1;
        public const int Theme_windowFixedHeightMinor = -1;
        public const int Theme_windowFixedWidthMajor = -1;
        public const int Theme_windowFixedWidthMinor = -1;
        public const int Theme_windowMinWidthMajor = -1;
        public const int Theme_windowMinWidthMinor = -1;
        public const int Theme_windowNoTitle = -1;
    }
    

    }
    }

    It worked for me ! :smile:

  • JonHuntJonHunt USMember ✭✭

    I've uninstalled all the Nuget packages and only installed Xamarin Forms (now tried both version 2.2.0.31 and 2.2.0.45) with no luck. It installs the support libraries which I assume are the compatible versions. I'm not using XLabs. The only 3rd party stuff I'm using is ZXing barcode library, and a Xamarin Connectivity Plugin.

  • JonHuntJonHunt USMember ✭✭

    I have the v23 of the Android SDK installed (verified through SDK manager). Not using XLabs. None of the suggestions have worked so far.

  • JulienRosenJulienRosen CAMember ✭✭✭✭

    the zxing component is not compatible.

    the nuget -pre package is

  • ClowningClowning USMember ✭✭

    With my code there are no problem normally !

  • JonHuntJonHunt USMember ✭✭

    @Clowning your code only solves about 50-100 of the warnings, I had over 500. It would have taken a while to go through every error and add that property to your partial class. Thank you for your suggestions though! It did help me get to the right result.

  • ClowningClowning USMember ✭✭

    Ok perfect :) !

  • @JonHunt Which version of all this packages did you install (and xamarin forms too, which version ? ) ? I have the same problem but I didn't make it work with your solution

  • JonHuntJonHunt USMember ✭✭

    Version 23.3.0 of all those Android support packages, and Xamarin Forms 2.2.0.45.

Sign In or Register to comment.