简体   繁体   中英

Android Studio Project Build Output Error: Task :app:mergeDebugResources FAILED

Build Output Details:

Task:app:mergeDebugResources C:\Users\userName.gradle\caches\transforms-3\ee0550e8848c5279ef1306690d07508f\transformed\fragment-1.3.6\res\values\values.xml:2:4:>item> inner element must either be a resource reference or empty.

Task:app:createDebugCompatibleScreenManifests Task:app:extractDeepLinksDebug Task:app:mergeDebugResources FAILED

Failed to compile values file.

values.xml Original file

<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="fragment_container_view_tag" type="id"/>
<item name="special_effects_controller_view_tag" type="id"/>
<item name="visible_removing_fragment_view_tag" type="id"/>
<declare-styleable name="Fragment">
    <attr name="android:name"/>
    <attr name="android:id"/>
    <attr name="android:tag"/>
</declare-styleable>
<declare-styleable name="FragmentContainerView">
    <attr name="android:name"/>
    <attr name="android:tag"/>
</declare-styleable>

I get the same error when I do following changes in values.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="fragment_container_view_tag" type="id"/>
    <item name="special_effects_controller_view_tag" type="id"/>
    <item name="visible_removing_fragment_view_tag" type="id"/>
</resources>

You cannot write items directly under sources here. I prepared an example for you.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <array name="your_array_list_name">
        <item name="fragment_container_view_tag" type="id"/>
        <item name="special_effects_controller_view_tag" type="id"/>
        <item name="visible_removing_fragment_view_tag" type="id"/>
    </array>
</resources>

In my case, there is recently generated ids.xml file under app/src/main/res/values, and the error is gone after I delete this file. Wish it works for you.

AT

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM