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

Error: Duplicate resources is showing when trying to run ./gradlew assembleRelease #31769

Closed
danielbbt opened this issue Jun 24, 2021 · 5 comments

Comments

@danielbbt
Copy link

danielbbt commented Jun 24, 2021

React Native version: 0.63.4

Please note that I have already tried the solutions in but still to no avail:
#22234
#26245
https://shreyasnisal.medium.com/solved-packing-error-in-react-native-release-apk-f887687edc4f

The error that I am receiving is below:

[raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.json
[raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.ttf
Error: Duplicate resources
@SConaway
Copy link
Contributor

Probably too simple of a solution / thought, but here's what I'm thinking:

Is it possible that you've copied the assets_fonts_galioextra.json and assets_fonts_galioextra.ttf files yourself to somewhere in android/app/src/main/res/? Maybe you already copied it once, and then some part of the build script is copying it again.

Also try cleaning everything with: ./gradlew clean and then rebuild.

@developerdanx
Copy link

React Native version: 0.63.4

Please note that I have already tried the solutions in but still to no avail:
#22234
#26245
https://shreyasnisal.medium.com/solved-packing-error-in-react-native-release-apk-f887687edc4f

The error that I am receiving is below:

[raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.json
[raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.ttf
Error: Duplicate resources

@danielbbt I have the same problem as you and the solutions didn't work for me either.

Did you found something else ? :)

@samin-alabz
Copy link

Just to put it out there and to help anyone who is still looking

[raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.json [raw/assets_fonts_galioextra] android/app/build/generated/res/react/release/raw/assets_fonts_galioextra.ttf Error: Duplicate resources

You have a file assets/fonts/galioextra.json which is shown as "assets_fonts_galioextra.json". Notice the other one has the same name, regardless of the extension.

Renaming one of the file will resolve this issue :)

@andreiciceu
Copy link

The problem for my setup was this line in app/build.gradle leftover from older react-native versions:

apply from: "../../node_modules/react-native/react.gradle"

removed it and build works now

@cortinico
Copy link
Contributor

React Native version: 0.63.4

Closing as this is on a really old RN version, the issue is missing our template and is not actionable. Some of the workaround provided were also valid so there is nothing left for us to do here.

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

No branches or pull requests

6 participants