I am trying to build an apk file using android studio, and facing duplicated resources error
I have tried to delete some of duplicates but with no luck
[drawable-xhdpi-v4/assets_images_ic_share] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_share.png [drawable-xhdpi-v4/assets_images_ic_share] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_share.png: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativedropdownalert_assets_error] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativedropdownalert_assets_error.png [drawable-xhdpi-v4/node_modules_reactnativedropdownalert_assets_error] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/node_modules_reactnativedropdownalert_assets_error.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_favorite] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_favorite.png [drawable-xhdpi-v4/assets_images_ic_favorite] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_favorite.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_favorited] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_favorited.png [drawable-xhdpi-v4/assets_images_ic_favorited] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_favorited.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_success] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_success.png [drawable-xhdpi-v4/assets_images_ic_success] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_success.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_comment] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_comment.png [drawable-xhdpi-v4/assets_images_ic_comment] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_comment.png: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativedropdownalert_assets_info] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativedropdownalert_assets_info.png [drawable-xhdpi-v4/node_modules_reactnativedropdownalert_assets_info] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/node_modules_reactnativedropdownalert_assets_info.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_add_comment] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_add_comment.png [drawable-xhdpi-v4/assets_images_ic_add_comment] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_add_comment.png: Error: Duplicate resources
[drawable-xhdpi-v4/assets_images_ic_white_more] /Users/hadi/Desktop/lancer/beonews/android/app/src/main/res/drawable-xhdpi/assets_images_ic_white_more.png [drawable-xhdpi-v4/assets_images_ic_white_more] /Users/hadi/Desktop/lancer/beonews/android/app/build/generated/res/react/release/drawable-xhdpi/assets_images_ic_white_more.png: Error: Duplicate resources
Related
I've tried all the techniques which were provided on stack overflow but I am still getting the same error. Even after modifying the name, when I am try rebuilding the gradle, again the same is being updated to the previous value and the error is being arose.
The error is :
Error:(246, 5) error: duplicate value for resource 'attr/font' with config ''
I am currently using React Native for my android app. The version of RN is 0.46.1 and the CLI is 2.0.1. Gradle as according to my Android Studio is version 3.3.
I managed to install my app into Android Emulator using "react-native run-android" without much issue. It works fine, but when I tried to generate apk, I got some errors. I am running on Windows 10.
Commands executed:
react-native bundle --platform android --dev false --entry-file index.android.js \ --bundle-output android/app/src/main/assets/index.android.bundle \ --assets-dest android/app/src/main/res/
cd android && gradlew assembleRelease
Right after 2nd command above, I got some errors:
:app:mergeReleaseResources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_disabled.png [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_disabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travel022.jpg [drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travel022.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_up128.png [drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_up128.png: Error: Duplicate resources
[drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_openenvelopewithletter_31832670.jpg [drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_openenvelopewithletter_31832670.jpg: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_down128.png [drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_down128.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_enabled.png [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_enabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_weather1gif.png [drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_weather1gif.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_back_chevron.png [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_back_chevron.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_accommodation_icon1.png [drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_accommodation_icon1.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_noimage.gif [drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_noimage.gif: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_itineraryicon.png [drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_itineraryicon.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativedatepicker_date_icon.png [drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativedatepicker_date_icon.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travelguide.jpg [drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travelguide.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_menu_burger.png [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_menu_burger.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_embedplacesicon.png [drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_embedplacesicon.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_diningicon.png [drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_diningicon.png: Error: Duplicate resources
:app:mergeReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_disabled.png [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_disabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travel022.jpg [drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travel022.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_up128.png [drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_up128.png: Error: Duplicate resources
[drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_openenvelopewithletter_31832670.jpg [drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_openenvelopewithletter_31832670.jpg: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_down128.png [drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_down128.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_enabled.png [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_enabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_weather1gif.png [drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_weather1gif.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_back_chevron.png [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_back_chevron.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_accommodation_icon1.png [drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_accommodation_icon1.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_noimage.gif [drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_noimage.gif: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_itineraryicon.png [drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_itineraryicon.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativedatepicker_date_icon.png [drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativedatepicker_date_icon.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png [drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travelguide.jpg [drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travelguide.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png [drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_menu_burger.png [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_menu_burger.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_embedplacesicon.png [drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_embedplacesicon.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_diningicon.png [drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_diningicon.png: Error: Duplicate resources
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 20.5 secs
I found some forums discussing similar problems https://github.com/facebook/react-native/issues/5787 but it doesn't really solve the problem (tried removing generated output files, even trie snippet code as suggested in the forum).
I ran into this problem as well. Here is how I fixed it. This is the most complex and robust way - see the end for easier options.
Renamed all my android/app/src/main/res/drawable-* folders, adding a -v4 to them all. (After this they look like: drawable-xhdpi-v4, drawable-ldpi-v4, etc.) Note: don't change the drawable folder itself.
Add a post-install hook to package.json that fixes the node_modules/react-native/local-cli/bundle/assetPathUtils.js file by adding -v4 to all of the switch statement's return values. The resulting switch statement in the assetPathUtils.js file should look like this:
switch (scale) {
case 0.75: return 'ldpi-v4';
case 1: return 'mdpi-v4';
case 1.5: return 'hdpi-v4';
case 2: return 'xhdpi-v4';
case 3: return 'xxhdpi-v4';
case 4: return 'xxxhdpi-v4';
}
This is one way to write that post-install hook:
const sh = require('shelljs');
const fileToFix =
'node_modules/react-native/local-cli/bundle/assetPathUtils.js';
const replacements = [
["case 0.75: return 'ldpi';", "case 0.75: return 'ldpi-v4';"],
["case 1: return 'mdpi';", "case 1: return 'mdpi-v4';"],
["case 1.5: return 'hdpi';", "case 1.5: return 'hdpi-v4';"],
["case 2: return 'xhdpi';", "case 2: return 'xhdpi-v4';"],
["case 3: return 'xxhdpi';", "case 3: return 'xxhdpi-v4';"],
["case 4: return 'xxxhdpi';", "case 4: return 'xxxhdpi-v4';"],
];
const content = sh.cat(fileToFix).stdout;
const fixedContent = replacements.reduce(
(accumulator, [oldStr, newStr]) => accumulator.replace(oldStr, newStr),
content
);
sh.ShellString(fixedContent).to(fileToFix);
And registering it in your package.json
...
"scripts": {
"postinstall": "node ./postinstall.js",
...
Other fixes from the 5787 issue:
If you don't have any custom icons in your drawable-* folders then you should be able to delete them all and have things work that way. (this is one I haven't personally confirmed)
If you don't need to use gradle v3+, then downgrading back to gradle v2.* will resolve the issue - although Android studio will continually prompt you to upgrade gradle.
My project was compiling fine until I deleted some png drawables and replaced them with vector drawables by navigating to New > Vector Asset. I am now getting a duplicate resources error.
Here is my res folder:
Here is the error message in the Gradle console:
Execution failed for task ':app:mergeDebugResources'.
> [drawable/ic_menu_manage] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_manage.xml [drawable/ic_menu_manage] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
[drawable/ic_menu_share] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_share.xml [drawable/ic_menu_share] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
[drawable/ic_menu_slideshow] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_slideshow.xml [drawable/ic_menu_slideshow] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
[drawable/ic_menu_send] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_send.xml [drawable/ic_menu_send] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
[drawable/ic_menu_gallery] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_gallery.xml [drawable/ic_menu_gallery] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
[drawable/ic_menu_camera] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_camera.xml [drawable/ic_menu_camera] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
How do I fix this and why is it happening?
The error suggests that the drawable.xml file is responsible for the error. So I opened it and commented out the xml code and the app ran fine. I have no idea why this fixes it but this solved the problem.
when we add some new thing in out project, in that case some times resources might get duplicate that time it will give the error while run the app, in my case also get same issue I had face, while I had added the kotlin activity in java project, in it gives me error
Execution failed for task ':app:mergeDebugResources'. ...\themes.xml: Error: Duplicate resources
so in this case please check the local history and remove the duplicate resources from res folder, so simply revert that changes
To revert changes click on res folder and go to local history and check the duplicate file name and revert that changes which was not present in running code
in my case there was \themes.xml file is added newly so I reverted that changes and run code, it run successfully
I am trying to build my Android app and am recieving this error:
Error:Error: Duplicate resources: /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/src/main/res/values/dimens_orange.xml:dimen/tab_host_default_height, /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/src/main/res/values/dimens_finalbeertheme.xml:dimen/tab_host_default_height
And also this error:
Error:Execution failed for task ':BeerPprtfolio:mergeDebugResources'.
> /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/src/main/res/values/dimens_orange.xml: Error: Duplicate resources: /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/src/main/res/values/dimens_orange.xml:dimen/tab_host_default_height, /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/src/main/res/values/dimens_finalbeertheme.xml:dimen/tab_host_default_height
This is after trying to import a custom theme from Android Holo Colors.
You must eliminate one of dimen/tab_host_default_height in your dimens_orange.xml or dimens_finalbeertheme.xml, because they are duplicate.
Check your error "Error: Duplicate resources:"
Im trying to add a Library Project (https://github.com/inmite/android-styled-dialogs) to my Android Studio project.
However I get the following build errors because my build is not able to reference the values in the Android-styled-dialog LibraryProject
android-apt-compiler: [NavigationDrawer] /Users/Jase/Downloads/NavigationDrawer/res/values-v11/themes_apptheme.xml:23: error: Error retrieving parent for item: No resource found that matches the given name 'DialogStyleLight'.
android-apt-compiler: [NavigationDrawer] /Users/Jase/Downloads/NavigationDrawer/res/values-v11/themes_apptheme.xml:30: error: Error: No resource found that matches the given name: attr 'buttonBackgroundColorNormal'.
android-apt-compiler: [NavigationDrawer] /Users/Jase/Downloads/NavigationDrawer/res/values-v11/themes_apptheme.xml:29: error: Error: No resource found that matches the given name: attr 'buttonSeparatorColor'.
....
I don't really know anything about Gradle but I feel that I possibly need to tell the build to reference Android-styled-dialog. I don't know I'm completely lost...
PS: When I created a new android studio project with the demo project for Android-Styled-Dialogs it created the following mavin file... which I don't have in my other project - https://gist.github.com/anonymous/8207108
I don't really know anything about Java build systems, please help