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

Fix duplicate resource error in Android gradle build (#22234) #24778

Closed
wants to merge 1 commit into from

Conversation

Dbroqua
Copy link
Contributor

@Dbroqua Dbroqua commented May 9, 2019

Summary:

If $buildDir/generated/res/react/${flavorPathSegment}release/raw contains files during gradle assembleRelease script will fail with Error: Duplicate resources error.

This patch is based on this issue 22234 and pull request 24518.

Changelog

[Android] [Fixed] - Fix duplicate resource error for raw folder in Android build

Test plan

[CC from Mike Hardy PR]
Reports of success on the linked issue via use of the patch + patch-package for a couple months, I personally use it full time with all gradle builds (./gradlew clean assembleRelease or if you have a 'staging' flavor, e.g. ./gradlew clean assembleStagingRelease)

Related reading, also cross-links with the linked issue here:
https://stackoverflow.com/questions/53239705/react-native-error-duplicate-resources-android

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@pull-bot
Copy link

pull-bot commented May 9, 2019

Messages
📖 📋 Missing Summary - Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.
📖 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.
📖

📋 Missing Changelog - Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

CATEGORY may be:
  • General
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

Generated by 🚫 dangerJS against 91a2175

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 9, 2019
@react-native-bot react-native-bot added Platform: Android Android applications. Bug labels May 9, 2019
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@radeno
Copy link
Contributor

radeno commented May 9, 2019

This PR could close #24759

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @Dbroqua in eb534bc.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 9, 2019
@mikehardy
Copy link
Contributor

Fantastic you guys! Thanks @Dbroqua and @cpojer - I hope this smooths things out for everyone in the new gradle versions

@Dbroqua
Copy link
Contributor Author

Dbroqua commented May 9, 2019

You're welcome!

@DriesVS
Copy link

DriesVS commented May 9, 2019

Awesome! Works with latest build tools 🚀

facebook-github-bot pushed a commit that referenced this pull request Jun 24, 2019
Summary:
Pull requests #24518 #24778 make Gradle copy all **generated** assets and resources into `android/app/src/res`, which is a bad behavior, because `src/res` goes into version control and should hold only those **original** resource files.

These changes in #24518 #24778 were merged into 0.60.0-rc release and cause regression.

This pull request will:

- Revert pull requests #24518 #24778
- Close #25325

## Changelog

[Android] [Fixed] - Fix regression of improper assets copy (revert #24518 #24778)
Pull Request resolved: #25363

Test Plan: It is a revert pull request and the reverted script should work the same as it has in 0.59.x.

Differential Revision: D15963329

Pulled By: cpojer

fbshipit-source-id: 5619a318dbdb40e816e37b6e37d4fe32caa46e9e
kelset pushed a commit that referenced this pull request Jun 28, 2019
Summary:
Pull requests #24518 #24778 make Gradle copy all **generated** assets and resources into `android/app/src/res`, which is a bad behavior, because `src/res` goes into version control and should hold only those **original** resource files.

These changes in #24518 #24778 were merged into 0.60.0-rc release and cause regression.

This pull request will:

- Revert pull requests #24518 #24778
- Close #25325

## Changelog

[Android] [Fixed] - Fix regression of improper assets copy (revert #24518 #24778)
Pull Request resolved: #25363

Test Plan: It is a revert pull request and the reverted script should work the same as it has in 0.59.x.

Differential Revision: D15963329

Pulled By: cpojer

fbshipit-source-id: 5619a318dbdb40e816e37b6e37d4fe32caa46e9e
M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this pull request Mar 10, 2020
…k#24778) (facebook#25363)

Summary:
Pull requests facebook#24518 facebook#24778 make Gradle copy all **generated** assets and resources into `android/app/src/res`, which is a bad behavior, because `src/res` goes into version control and should hold only those **original** resource files.

These changes in facebook#24518 facebook#24778 were merged into 0.60.0-rc release and cause regression.

This pull request will:

- Revert pull requests facebook#24518 facebook#24778
- Close facebook#25325

## Changelog

[Android] [Fixed] - Fix regression of improper assets copy (revert facebook#24518 facebook#24778)
Pull Request resolved: facebook#25363

Test Plan: It is a revert pull request and the reverted script should work the same as it has in 0.59.x.

Differential Revision: D15963329

Pulled By: cpojer

fbshipit-source-id: 5619a318dbdb40e816e37b6e37d4fe32caa46e9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants