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
Related
Trying to build the app but have got the error: The error Confugure image asset1
Confugure image asset2
Confugure image asset3
ERROR:C:\Users\Alex\AndroidStudioProjects\Lm2\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:3: AAPT: error: resource mipmap/ic_launcher_background (aka com.example.lm2:mipmap/ic_launcher_background) not found.
How can I resolve this?
I hope you have
put your launcher icons into the mipmap folder where they should always go.
added your adaptive icon to the app’s manifest.xml for “android:icon” (android:roundIcon) attribute
.
Fist hand try: Clean your project and Rebuild
Probable Issue reason: Malformed XML:
Solution:
Check if you have anything duplicated by mistake in your XML
Try Analyze > Inspect Code it will redirect you to the exact error.
Android resource linking failed
C:\Users\Afraz\Desktop\Summaira
FYP\PHMS\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2103:
error: resource android:attr/foregroundInsidePadding is private.
C:\Users\Afraz\Desktop\Summaira
FYP\PHMS\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2433:
error: resource android:attr/popupPromptView is private. error: failed
linking references.
Just don't use android:attr/foregroundInsidePadding and android:attr/popupPromptView. They would be public if they were meant to be used.
I have coincided this error couple of times before so I recommend you to delete your .idea file and then apply invalidate cashes and restart in AS. You will get rid of this error after that
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.
I accidentally created new drawable value resources :
Here is a snapshot of how i did it
How can i delete these two resource ?
the two resorces i want to delete : Jobs,jobs
I am getting this build error:
/home/thebitshoes/Desktop/ClassProject/app/build/intermediates/res/merged/debug/values/values.xml
Error:(484, 69) String types not allowed (at 'Jobs' with value '').
Error:(484, 69) String types not allowed (at 'Jobs' with value '').
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Close the project, go to the specific file externally and remove the resource value(if this doesn't work then delete file) and then start the project again. It helped me.
Okay!! here I figured it out :
My values folder contained an XML file named refs.xml . Inside the file , i had two resource items Jobs , job . I deleted the refs file itself . Now its working!!!
Thank you all!! :)
Delete your xml file or rename it with small character and valid file name,
in App module delete "build" directory, then rebuild the directory hope this helps. Because build directory has old references.
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:"