4

I've been searching for a solution for this but nobody actually can confirm ... when creating new android studio project

"colors.xml:9:18: Error: XML document structures must start and end within the same entity."

I open that colors.xml it contains some wierd stuff :

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="AndroidLayouts">
        <shared>
            <config />
        </shared>
    </component>
    <component name="AndroidLogFilters">
        <option n

and YES that is the full file ... it's not my first project and i know that's not how the file should look , even if I replaced the content with the correct syntax , many error of the same type in other files as well , so my question is , why is this happening ? I tried clearing caches of android and deleted the cache of gradle entirely ...nothing seems to work , what could be the problem ? how this file even gets created in the first place ? is it a gradle problem ?

Lekr0
  • 653
  • 1
  • 8
  • 17
Ammar M Mashfj
  • 104
  • 1
  • 1
  • 10

5 Answers5

2

Follow these steps your problem will be solved:-

  1. Close the Android Studio.

  2. Go to: C:\users\your_user_name\.AndroidStudio3.4\system\caches

  3. Delete the caches folder.

  4. Go to: C:\Users\your_user_name\.gradle\caches

  5. Delete this caches folder also.

  6. Now you can start your Android Studio and start working.

Your Problem will be solved.

Dharmik Thakkar
  • 1,650
  • 1
  • 9
  • 18
1

I don't know how you got that color xml but that's definitely not a color xml file.

A color.xml file looks like below image

enter image description here

Copy below code to your color.xml file to solve your error.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="your_color">#FFFFFF</color>
</resources>
Lekr0
  • 653
  • 1
  • 8
  • 17
0

I'm literally facing the same issue, did you somehow managed to resolve it?

I though I've been getting this error after invalidating cache and restart Android Studio but it seems to be some kind of different bug from IDE itself.

dvlpr
  • 1
  • nope , no Answer yet , anyhow I've submitted the bug to google issuetracker.google.com/issues/119838399 – Ammar M Mashfj Dec 14 '18 at 14:39
  • droid version 3.2 is too messed up to resolve unexpected bugs at uncertain times, upgraded to Studio version 3.4 Canary 6 till they make previous versions stable or might stick up to it. – dvlpr Dec 15 '18 at 22:08
0

It may be which browser you got the install file from. (This answer also appears at colors.xml: Error: Unsupported type 'component' (Android studio))

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?

0

I was just facing the same issue, an incomplete color.xml is generated which causes the build error, just create a new helloworld app project.

What I have done is deleting both the .AndroidStudio3.2 and .android folder in the window's user folder, and then the strange issue has gone...

Looks like a stange IDE bug...

eric
  • 140
  • 2
  • 12