Reputation: 104
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 ?
Upvotes: 4
Views: 13552
Reputation: 2158
Follow these steps your problem will be solved:-
Close the Android Studio.
Go to: C:\users\your_user_name\.AndroidStudio3.4\system\caches
Delete the caches folder.
Go to: C:\Users\your_user_name\.gradle\caches
Delete this caches folder also.
Now you can start your Android Studio and start working.
Your Problem will be solved.
Upvotes: 2
Reputation: 140
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...
Upvotes: 0
Reputation: 1
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?
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 733
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
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>
Upvotes: 1