React-Native 打包时候资源重复Error: Duplicate resources 解决方案

1.现象如下:

image.png

2. 如何解决:

找到react.gradle


image.png

加入这一坨代码:


image.png
 doLast {
                def moveFunc = { resSuffix ->
                    File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
                    if (originalDir.exists()) {
                        File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
                        ant.move(file: originalDir, tofile: destDir);
                    }
                }
                moveFunc.curry("ldpi").call()
                moveFunc.curry("mdpi").call()
                moveFunc.curry("hdpi").call()
                moveFunc.curry("xhdpi").call()
                moveFunc.curry("xxhdpi").call()
                moveFunc.curry("xxxhdpi").call()
            }

你可能感兴趣的:(React-Native 打包时候资源重复Error: Duplicate resources 解决方案)