Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate an apk failed on React native

When i'm build my React native project using this command

gradlew bundleRelease

Give a big error on Task :app:mergeReleaseResources

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeReleaseResources'.

    [drawable-hdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backicon] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-hdpi\node_modules_reactnavigation_stack_src_views_assets_backicon.png [drawable-hdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backicon] C:\Users\victo\Documents\git\melhor\app-user\android\app\build\generated\res\react\release\drawable-hdpi\node_modules_reactnavigation_stack_src_views_assets_backicon.png: Error: Duplicate resources [drawable-mdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backicon] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-mdpi\node_modules_reactnavigation_stack_src_views_assets_backicon.png [drawable-mdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backicon] C:\Users\victo\Documents\git\melhor\app-user\android\app\build\generated\res\react\release\drawable-mdpi\node_modules_reactnavigation_stack_src_views_assets_backicon.png: Error: Duplicate resources [drawable-mdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backiconmask] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-mdpi\node_modules_reactnavigation_stack_src_views_assets_backiconmask.png [drawable-mdpi-v4/node_modules_reactnavigation_stack_src_views_assets_backiconmask] C:\Users\victo\Documents\git\melhor\app-user\android\app\build\generated\res\react\release\drawable-mdpi\node_modules_reactnavigation_stack_src_views_assets_backiconmask.png: Error: Duplicate resources [drawable-mdpi-v4/src_assets_address_emptyaddress] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-mdpi\src_assets_address_emptyaddress.png [drawable-mdpi-v4/src_assets_address_emptyaddress] C:\Users\victo\Documents\git\melhor\app-user\android\app\build\generated\res\react\release\drawable-mdpi\src_assets_address_emptyaddress.png: Error: Duplicate resources [drawable-mdpi-v4/src_assets_address_faildelivery] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-mdpi\src_assets_address_faildelivery.png [drawable-mdpi-v4/src_assets_address_faildelivery] C:\Users\victo\Documents\git\melhor\app-user\android\app\build\generated\res\react\release\drawable-mdpi\src_assets_address_faildelivery.png: Error: Duplicate resources [drawable-mdpi-v4/src_assets_brands_bayer] C:\Users\victo\Documents\git\melhor\app-user\android\app\src\main\res\drawable-mdpi\src_assets_brands_bayer.png [drawable-mdpi-v4/src_assets_brands_bayer]

This error is larger and have more "Duplicated resources".

I see that is a problem with the images i use inside the aplication But that is only one image with those names with the name inside the app, why is "duplicated"?

and other assets like "node_modules_reactnavigation_stack_src_views_assets_backicon" assets on react navigation that i dont have control.

like image 375
Victor Sena de Lima Attar Avatar asked Mar 03 '23 11:03

Victor Sena de Lima Attar


1 Answers

This problem ocurrs because the project builded duplicates files.

To resolve it, you need delete the files inside of res folder.

Delete drawable folder and raw folder.

Your project directory will be like that:

enter image description here

like image 144
Lucas Moraes Avatar answered Mar 05 '23 14:03

Lucas Moraes