locked
Sudden error: "expected color but got (raw string)" in Android RRS feed

  • Question

  • User393906 posted

    Hi!

    I've updated Visual Studio to version 16.7.1 and ever since I did that I get an error which was not there before:

    This only happens with Android. Line 4 in styles.xml is this:

    I read something about updating from packges.config to PackagesReferences might help, but I'm unable to find the migration option in my solution (right-click on References does not show the migrate option).

    Does someone wthat is wrong here and how to solve this?

    Best regards

    Friday, August 14, 2020 5:28 PM

Answers

  • User369979 posted

    It was <item name="android:colorActivatedHighlight"></item> here: You didn't set any value here. Try to give it a color like:

    <item name="android:colorActivatedHighlight">#2196F3</item>
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, August 21, 2020 7:13 AM

All replies

  • User369979 posted

    Did it occur on a new blank application? Normally, we could fix this by a complete clean up like: delete bin/obj folders.

    Monday, August 17, 2020 9:14 AM
  • User393906 posted

    No. It happened on an existing app.

    I removed the bin and obj folder, did a Clean Solution in VS and then performed a Build Solution. The error still occured.

    Monday, August 17, 2020 9:16 AM
  • User369979 posted

    I haven't encountered this issue before. We need a repo to look into this error. If it is not convenient to share your project on this public forum, you could open a support ticket here: https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6.

    Tuesday, August 18, 2020 9:35 AM
  • User393906 posted

    I created a new app to see how it looks in styles.xml. I see some comments I didn't had before:

    It seems the version update to Xamarin.Forms 4.6 is causing the issue. Any ideas? I will use the support link as well.

    Tuesday, August 18, 2020 12:29 PM
  • User369979 posted

    The latest version of Xamarin Forms has reached 4.8: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/release-notes/ You could have a try with it. What have you set in the MainTheme.Base? An empty MainTheme should not throw this sort of error.

    Thursday, August 20, 2020 7:58 AM
  • User393906 posted

    Maybe you can see the issue with the full styles.xml:

            <?xml version="1.0" encoding="utf-8" ?>
            <resources>
    
              <style name="MainTheme" parent="MainTheme.Base">
              </style>
              <!-- Base theme applied no matter what API -->
              <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
                <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
                <item name="windowNoTitle">true</item>
                <!--We will be using the toolbar so no need to show ActionBar-->
                <item name="windowActionBar">false</item>
                <!-- Set theme colors from https://aka.ms/material-colors -->
                <!-- colorPrimary is used for the default action bar background -->
                <item name="colorPrimary">#2196F3</item>
                <!-- colorPrimaryDark is used for the status bar -->
                <item name="colorPrimaryDark">#1976D2</item>
                <!-- colorAccent is used as the default value for colorControlActivated
                     which is used to tint widgets -->
                <item name="colorAccent">#2196F3</item>
                <!-- You can also set colorControlNormal, colorControlActivated
                     colorControlHighlight and colorSwitchThumbNormal. -->
                <item name="windowActionModeOverlay">true</item>
    
                <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
    
                <item name="android:colorActivatedHighlight"></item>
              </style>
    
              <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
                <item name="colorAccent">#FF4081</item>
              </style>
    
              <style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
                <item name="android:windowBackground">@drawable/splash_screen</item>
                <item name="android:windowNoTitle">true</item>
                <item name="android:windowFullscreen">true</item>
                <item name="android:windowContentOverlay">@null</item>
                <item name="android:windowActionBar">true</item>
              </style>
    
            </resources>    
    
    Thursday, August 20, 2020 12:18 PM
  • User393906 posted

    Okay it most certainly NOT an issue with Xamarin Forms 4.6 or 4.8. I have another laptop with the exact same solution and the only difference is the Visual Studio version.

    Thursday, August 20, 2020 12:44 PM
  • User369979 posted

    It was <item name="android:colorActivatedHighlight"></item> here: You didn't set any value here. Try to give it a color like:

    <item name="android:colorActivatedHighlight">#2196F3</item>
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, August 21, 2020 7:13 AM
  • User393906 posted

    That's it! Thanks a lot! :)

    Friday, August 21, 2020 12:54 PM