Hi all gradle exports,

I found a strange error and have no idea why it is different with ant 
build. Could you please help me? Thanks a lot.

The problem is: 

Case1: I have 1 library projects (say lib1) and an app project (say mainapp), 
lib1 defines a custom attribute "*twice*"(attr_A.xml)
<declare-styleable name="CB">
  <attr name="android:checked" />
  <attr name="android:button" />
</declare-styleable>

<declare-styleable name="CB">
  <attr name="android:checked" />
  <attr name="android:button" />
</declare-styleable>

Then I will get the exception about:

Failed to parse xxxxx/xxxx/xxxx/xxxx/attr_A.xml 
java.io.IOException: Found item Declare Styleable/CB more than one time 
    at 
com.android.ide.common.res2.ValueResourceParser2.checkDuplicate(ValueResourceParser2.java:249)
 

    at 
com.android.ide.common.res2.ValueResourceParser2.parseFile(ValueResourceParser2.java:103)
 

    at 
com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:273)
 

    at 
com.android.ide.common.res2.ResourceSet.parseFolder(ResourceSet.java:248) 
    at 
com.android.ide.common.res2.ResourceSet.readSourceFolder(ResourceSet.java:134) 

    at com.android.ide.common.res2.DataSet.loadFromFiles(DataSet.java:235) 
    at 
com.android.ide.common.res2.ResourceSet.loadFromFiles(ResourceSet.java:47) 
 
xxxx:xxxx:mergeDebugResources FAILED 
 
FAILURE: Build failed with an exception. 
 
* What went wrong: 
Execution failed for task ':xxxxx:xxxx:mergeDebugResources'. 
> Found item Declare Styleable/CB more than one time

Case2: I have 1 library projects (say lib1) and an app project (say mainapp), 
lib1 defines the same attribute in different xml.(attr_A.xml and attr_B.xml)
attr_A.xml:
    <declare-styleable name="ListItemSeparator"> 
        <attr name="android:drawable" /> 
    </declare-styleable> 
attr_B.xml: 
    <declare-styleable name="ListItemSeparator"> 
        <attr name="leftText" format="string" /> 
        <attr name="middleText" format="string" /> 
        <attr name="rightText" format="string" /> 
        <attr name="leftIcon" format="reference" /> 
        <attr name="rightIcon" format="reference" /> 
        <attr name="android:icon" /> 
    </declare-styleable>

Both of the above cases will got the almost same error message about "Found 
item Declare Styleable/xxxx more than one time":
However, It will not happen in "ant build". I know the processResources 
task is the new task in gradle, ant doesn't include 
this task, but I would like to know if the two cases is not supported in 
gradle??? Thanks a lot for your great help.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to