Manuel Cárdenas
Manuel Cárdenas

Reputation: 119

colors.xml: Error: Unsupported type 'component' (Android studio)

After the creation of a new project, I get an error with the colors.xml file (more details here: Error on first build after creating a project: XML document structures must start and end within the same entity) I "fixed" the colors.xml file and now I get this new error:

colors.xml: Error: Unsupported type 'component'

The colors.xml file looks like this:

<application>
    <component name="PropertiesComponent">
        <property name="ATTACHED_TOOL_WINDOW.DEFAULT.NELE_EDITOR.COMPONENT_TREE.AUTO_HIDE" value="false" />
        <property name="ATTACHED_TOOL_WINDOW.DEFAULT"/>
    </component>
</application>

I havent done anything in the android project, I just created it and the first build does not work. Any help is greatly appreciated.

Upvotes: 1

Views: 2381

Answers (5)

ricardofonzo
ricardofonzo

Reputation: 13

I had the same error, but also something similar in several files of the project every time i open a new project. I followed something that someone (can't remember the name) answer in another question:

1.- go to your user folder -->androidStudio folder --> System folder 2.- delete the caches folder

After that the error haven't came back. Hope this help someone else.

Upvotes: 1

Matt Plumlee
Matt Plumlee

Reputation: 1

It may be which browser you got the install file from.

I just had a student with the same problem (version 3.3 now), and it appears to have been fixed by having him install from a file downloaded with Chrome rather than with Edge. Did you originally install with an install file obtained using Edge?

Upvotes: 0

suresh yadam
suresh yadam

Reputation: 172

Ohh I too faced similar problems after upgrading studio to 3.2.1

many issues from different files while creating new project:

  1. colors.xml

  2. ic_launcher_round.xml - mipmap

  3. ic_launcher_background.xml - drawable

I tried to change these but nothing worked, changing one is causing other issue.

Finally i have uninstalled 3.2.1 studio version and downloaded 3.1.4(android-studio-ide-173.4907809-windows.exe (828632688 bytes)) from here https://developer.android.com/studio/archive

and finally everything worked fine. Still i don't know is this an issue from 3.2.1 studio version.

Note: It's basically downgrading studio version :) worked for me.

Upvotes: 0

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#79302a</color>
<color name="colorPrimaryDark">#561e1c</color>
<color name="colorAccent">#345f41</color>
</resources>

This is what a colors.xml looks like. See if it works for you

Upvotes: 0

Bruno
Bruno

Reputation: 4007

There is no Component tag in a Color resource file.

Here is an example of colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
</resources>

Upvotes: 2

Related Questions