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

Summary:
Issue #22234 includes a number of people (myself included) suffering with duplicate resource errors while building in Android. We have been collectively using a patch there but I don't believe any attempt has been made to PR it upstream.

I am not excellent at gradle, so I may have approached this in completely the wrong way, but it works for me in the standard init templates, as well as my current work project which has a complicated 2 buildType + 4 productFlavor configuration. If there is a better way to achieve the result I am happy to learn

The approach here is to determine the generated path the resources land in, then move them into the main build output tree. If they remain in the generated path android merging fails with duplicate resource errors, so that move (vs copy) is important.

[Android] [Fixed] - Fix duplicate resource error in Android build
Pull Request resolved: https://github.com/facebook/react-native/pull/24518

Differential Revision: D15276981

Pulled By: cpojer

fbshipit-source-id: 3fe8c8556e4dcdac5f96a2d4658ac9b5d9b67379

hoangpham95/react-native,exponent/react-native,facebook/react-native,exponent/react-native,hoangpham95/react-native,pandiaraj44/react-native,janicduplessis/react-native,javache/react-native,myntra/react-native,exponentjs/react-native,pandiaraj44/react-native,pandiaraj44/react-native,hammerandchisel/react-native,arthuralee/react-native,janicduplessis/react-native,hoangpham95/react-native,myntra/react-native,myntra/react-native,facebook/react-native,javache/react-native,myntra/react-native,arthuralee/react-native,hammerandchisel/react-native,exponent/react-native,myntra/react-native,exponent/react-native,hammerandchisel/react-native,hammerandchisel/react-native,hoangpham95/react-native,javache/react-native,javache/react-native,pandiaraj44/react-native,javache/react-native,javache/react-native,javache/react-native,hammerandchisel/react-native,pandiaraj44/react-native,exponentjs/react-native,facebook/react-native,pandiaraj44/react-native,javache/react-native,exponentjs/react-native,hoangpham95/react-native,exponentjs/react-native,javache/react-native,arthuralee/react-native,janicduplessis/react-native,janicduplessis/react-native,arthuralee/react-native,pandiaraj44/react-native,exponentjs/react-native,exponent/react-native,janicduplessis/react-native,exponentjs/react-native,hammerandchisel/react-native,exponent/react-native,myntra/react-native,facebook/react-native,janicduplessis/react-native,myntra/react-native,hoangpham95/react-native,exponentjs/react-native,janicduplessis/react-native,facebook/react-native,facebook/react-native,janicduplessis/react-native,facebook/react-native,myntra/react-native,myntra/react-native,hoangpham95/react-native,hoangpham95/react-native,arthuralee/react-native,exponent/react-native,exponent/react-native,pandiaraj44/react-native,facebook/react-native,hammerandchisel/react-native,exponentjs/react-native,facebook/react-native,hammerandchisel/react-native