Issue
Following is the awkward and incomplete colors.xml
I get while trying to create an Android project using Android Studio 3.2.1.
The error I get is D:\AndroidStudioWorkspace\PlayCardz\app\src\main\res\values\colors.xml:7:19: Error: XML document structures must start and end within the same entity.
Why is it happening?
Update
After manually changing colors.xml file to following I start getting the following error:
Android resource compilation failed
Output: D:\AndroidStudioWorkspace\GameCardz\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:1: error: not well-formed (invalid token).
Command: C:\Users\docrk\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a0fab621f980e2e9b95746cdfd1fc60d\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
D:\AndroidStudioWorkspace\GameCardz\app\build\intermediates\res\merged\debug \
D:\AndroidStudioWorkspace\GameCardz\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
Manually updated colors.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- color for the app bar and other primary UI elements -->
<color name="colorPrimary">#3F51B5</color>
<!-- a darker variant of the primary color, used for
the status bar (on Android 5.0+) and contextual app bars -->
<color name="colorPrimaryDark">#303F9F</color>
<!-- a secondary color for controls like checkboxes and text fields -->
<color name="colorAccent">#FF4081</color>
</resources>
Solution
This file is copied from <Android Studio install dir>/plugins/android/lib/templates/gradle-projects/NewAndroidModule/root/res/values/colors.xml
. Check for it to find any error in this file.
For me, the content of this file is
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>
Overwrite it if your template is modified.
Update for the updated question: I think your project template is totally overwritten with a mess. You may recursively find what the error of your templates are, by finding the source of error output of the file path (for example, the error in the update says file (D:\AndroidStudioWorkspace\GameCardz\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml
, which can be mapped into the template file <Android Studio install dir>/plugins/android/lib/templates/gradle-projects/NewAndroidModule/root/res/mipmap-anydpi-v26/ic_launcher_round.xml
.), correct each of them.
Or, since this template locates in <Android Studio install dir>
(actually it is a bundled plugin), you may reinstall your Android Studio, or reinstall (but, how to?) that plugin to fix this issue.
Answered By - Geno Chen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.