1

I have read and follow this solution to delete drawable files but it is still not working. This is the link that I follow: Error Execution failed for task ':app:mergeReleaseResources' building APK

Here is the error code after i have followed the above method:

> Task :app:mergeReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> [raw/app] C:\Users\User\Documents\Me\codes\Startup Project\iOrder_Merchant_recreate\android\app\src\main\res\raw\app.json     [raw/app] C:\Users\User\Documents\Me\codes\Startup Project\iOrder_Merchant_recreate\android\app\build\generated\res\react\release\raw\app.json: Error: Duplicate resources
  [raw/node_modules_reactnativevectoricons_glyphmaps_ionicons] C:\Users\User\Documents\Me\codes\Startup Project\iOrder_Merchant_recreate\android\app\src\main\res\raw\node_modules_reactnativevectoricons_glyphmaps_ionicons.json       [raw/node_modules_reactnativevectoricons_glyphmaps_ionicons] C:\Users\User\Documents\Me\codes\Startup Project\iOrder_Merchant_recreate\android\app\build\generated\res\react\release\raw\node_modules_reactnativevectoricons_glyphmaps_ionicons.json: Error: Duplicate resources

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5m 10s

Any help?

Jin Tan
  • 518
  • 6
  • 19
  • Can you please close all your nodes and kill all the ongoing processes that are used in your current project and after that re-run your project. It works for me everytime, tell me after trying this – Bhupesh Kumar Aug 27 '20 at 11:39
  • Thanks for your suggestion, i have found an answer and have posted it at the answer section. – Jin Tan Aug 27 '20 at 11:52

2 Answers2

2

After researching on google and find no other similar solution, i then try to delete the duplicate files mention in the error and it works! These are the 2 files i have removed:

  1. android\app\src\main\res\raw\app.json
  2. android\app\build\generated\res\react\release\raw\app.json

After removing these 2 files, i then run:

cd android
./gradlew assembleRelease

Then it shows me build successful :)

Jin Tan
  • 518
  • 6
  • 19
0

You need to clean the duplicates resources.

use the following commands

rm -rf ./android/app/src/main/res/drawable-*
rm -rf ./android/app/src/main/res/raw