我已经搜索了与此问题相关的一些信息。当我使用com.midtrans:uikit:1.21.2
和:react-native-camera
然后运行构建脚本时,发生此错误。
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
此错误是指rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
上的这一行
然后我发现如果有多个键具有相同的值。
react-native-camera
上的{li} android/src/main/res/value/attrs.xml
resources,键为<attr format="string" name="aspectRatio"/>
com.midtrans:uikit
上的{li} uikit/src/main/res/value/attrs.xml
resources,键为<attr format="float" name="aspectRatio"/>
我需要帮助来纠正此错误,或者需要任何信息来纠正/避免这种情况。 我检查了一些线程。
任何帮助都是谢谢。