androidxmlreact-nativegradle

Duplicate value for resource 'attr/actionBarSize'


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:

Only internal build files.

I tried to:

But I still have the same issue


Solution

  • 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