Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to merge resources, duplicate attr/scaleType error #487

Closed
lgrimes opened this issue Mar 26, 2020 · 5 comments · Fixed by #490
Closed

Unable to merge resources, duplicate attr/scaleType error #487

lgrimes opened this issue Mar 26, 2020 · 5 comments · Fixed by #490
Assignees
Labels

Comments

@lgrimes
Copy link

lgrimes commented Mar 26, 2020

Description

When trying to build our existing app after integrating com.twilio:video-android:5.2.0, the build will fail at mergeStagingDebugResources task with the following errors:

AAPT: error: duplicate value for resource 'attr/scaleType' with config ''.
AAPT: error: resource previously defined here.

We are also using androidx.camera:camera-view:1.0.0-alpha03 which is also declaring a scaleType attribute. This is the error when trying to merge the 2 resources. Have tried updating this to alpha08 and issue persists

.gradle/caches/transforms-2/files-2.1/c7a0ee02aa85f6263deaf25d70997022/camera-view-1.0.0-alpha03/res/values/values.xml:3:5-25:25: AAPT: error: duplicate value for resource 'attr/scaleType' with config ''.

The values.xml file of the video-android

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr format="boolean" name="mirror"/>
    <attr format="enum" name="scaleType">
        <enum name="fit" value="0"/>
        <enum name="fill" value="1"/>
        <enum name="balanced" value="2"/>
    </attr>
    <declare-styleable name="VideoTextureView">
        <attr name="mirror"/>
        <attr name="scaleType"/>
    </declare-styleable>
    <declare-styleable name="VideoView">
        <attr name="mirror"/>
        <attr name="scaleType"/>
        <attr name="overlaySurface"/>
    </declare-styleable>
</resources>

Notes

  • We have android.useAndroidX=true
  • We also have android.enableJetifier=true
  • Tested with both video-android:5.2.0, video-android:5.1.0

Expected Behaviour

The build would succeed and merging resources would complete

Actual Behaviour

The build fails and resources are not able to be merged

Reproduces how Often

Every build. Removing dependency resolves issue

Logs

AAPT: error: duplicate value for resource 'attr/scaleType' with config ''.
AAPT: error: resource previously defined here.

Video Android SDK

com.twilio:video-android:5.2.0

Android API

compileSdkVersion 28

Android Device

N/A

@aaalaniz
Copy link
Contributor

Hey @lgrimes

Thank you for filing the issue. I have reproduced locally. I'll see if I can put together a workaround. The issue seems to be related to clashing resource names between our SDK and the CameraX library.

Thanks!

@fredwu
Copy link

fredwu commented Mar 29, 2020

Hi @aaalaniz, thanks for confirming the issue, any updates by any chance? :)

@aaalaniz
Copy link
Contributor

Hey @lgrimes @fredwu

I was trying to put together a workaround for this issue, but I cannot find any recommended ways of merging attributes with the same name. I did fix the issue by prefixing our VideoView/VideoTextureView attributes, but it does require an update to the SDK itself.

We will ship a fix for this in 5.4.0 and I will update the ticket when the version is released.

Thank everyone!

@aaalaniz aaalaniz self-assigned this Mar 31, 2020
@aaalaniz aaalaniz added the bug label Mar 31, 2020
@aaalaniz
Copy link
Contributor

Fixed in Video Android 5.4.0.

Thanks for filing the issue!

@Jayjerome
Copy link

I'm getting similar problem and cant seem to find which library causes the problem
Duplicate value for resource 'attr/scaleType' with config 'DEFAULT' and product ''.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants