Reputation: 502
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 on android/src/main/res/value/attrs.xml
with key <attr format="string" name="aspectRatio"/>
com.midtrans:uikit
resources on uikit/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.
Any help would be thanks.
Upvotes: 0
Views: 706
Reputation: 44
Few solution you might interested to:
Fork the react-native-camera in GitHub to yours and modify the styles.xml and attrs.xml and add it to your react native project.
Use the other's forked project from com.midtrans in here. Veritrans has clearly stated that they won't support react-native project and might not merge this pull request.
I will recommend the solution no 1. I have forked and modify the resource value and some modification on others to follow my requirement needs. Feel free to take a look: here
Upvotes: 1