skip to Main Content

I am trying to upgrade react-native from 0.74.3 to 0.76.2 and building on android I have the following error:

/Users/xxx/.gradle/caches/8.10.2/transforms/0fd0166c4f0b7f2b3a94f0420432a518/transformed/material-1.6.1/res/values/values.xml:7497:4: Duplicate value for resource 'attr/actionBarSize' with config 'DEFAULT' and product ''. Resource was previously defined here: com.xxx.xxx.app-mergeDebugResources-79:/values/values.xml:8497: .

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed (Failed to compile values resource file /Users/xxx/Developer/xxx/app-native/android/app/build/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml. Cause: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@329c2b83) to table.). Check logs for more details.

Looks like there is an issue with actionBarSize in my xml values, I did a file search and I can only find this value in the build fine, the value is not present in my code not node_modules.

The files where this value is present are:

  • ./android/app/build/intermediates/incremental/release/mergeReleaseResources/merged.dir/values-v21/values-v21.xml
  • ./android/app/build/intermediates/incremental/release/mergeReleaseResources/merged.dir/values/values.xml
  • ./android/app/build/intermediates/incremental/release/mergeReleaseResources/merger.xml
  • ./android/app/build/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-v21/values-v21.xm
  • ./android/app/build/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml
  • ./android/app/build/intermediates/incremental/debug/mergeDebugResources/merger.xml

Only internal build files.

I tried to:

  • remove node_mudules and reinstall
  • remove /Users/xxx/.gradle
  • remove ./android/app/build
  • run ./gradlew clean

But I still have the same issue

2

Answers


  1. Chosen as BEST ANSWER

    From the helper https://react-native-community.github.io/upgrade-helper/?from=0.74.3&to=0.76.2 I had to remove android.enableJetifier=true and it was causing the issue.

    With android.enableJetifier=true I have no problem


  2. Try to remove the gradle catch file and try again; it will work. I also face the same problem.

    If it does not work, then use this trick:

    1. run npm run android and when this starts to initiate, then clear terminal
    2. then run npm run start. I think this trick will work.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search