I'm already search several information related to this issue. When I use com.midtrans:uikit:1.21.2
and :react-native-camera
then run the build script, this error occurred.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: /rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:492: error: duplicate value for resource 'attr/aspectRatio' with config ''.
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:492: error: resource previously defined here.
Command: /userRoot/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/26099ef957fce779fbc384e01d71f8d6/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy \
-o \
/rootProject/android/app/build/intermediates/res/merged/debug \
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
Output: /userRoot/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.1.0.aar/f44a4b5427df6e671eadd76860228e04/res/values/values.xml:7:5-685: AAPT: error: duplicate value for resource 'attr/aspectRatio' with config ''.
/userRoot/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.1.0.aar/f44a4b5427df6e671eadd76860228e04/res/values/values.xml:7:5-685: AAPT: error: resource previously defined here.
Command: /userRoot/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/26099ef957fce779fbc384e01d71f8d6/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy \
-o \
/rootProject/android/app/build/intermediates/res/merged/debug \
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
This error is refers to this line on rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Then i found that if there are multiple key with the same value.
react-native-camera
resources onandroid/src/main/res/value/attrs.xml
with key<attr format="string" name="aspectRatio"/>
com.midtrans:uikit
resources onuikit/src/main/res/value/attrs.xml
with key<attr format="float" name="aspectRatio"/>
I need help to fix this error, or any information to fix/avoid this situation. There are some thread that I checked.
- React Native : Error: Duplicate resources - Android
- Unable to build android (because of duplicate dependecies ?)
- React Native Error: Duplicate resources, assets coming in some screens and not coming in others in android release APK
Any help would be thanks.