One fix for this is to move over to using an Android.bp to build your app
rather than an Android.mk 🙂

But I also submitted a fix for this into aosp/master last week:
https://android-review.googlesource.com/c/platform/build/+/1764131

- Dan

On Tue, Jul 20, 2021 at 9:42 AM [email protected] <
[email protected]> wrote:

> Hi ,
>
> Our Android 11 build has been failing randomly with the following error:
>
> *> cp: cannot create regular file
> 'out/target/common/R/androidx/vectordrawable/R.java': > File exists*
>
>
> then, We found the reason for the compilation failure in build/make/core/
> definitions.mk:
>
> define find-generated-R.java
> $(hide) for GENERATED_MANIFEST_FILE in `find $(1) \
>   -name Manifest.java 2> /dev/null`; do \
>     dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print
> $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
>     mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
>     cp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
>   done;
> $(hide) for GENERATED_R_FILE in `find $(1) \
>   -name R.java 2> /dev/null`; do \
>     dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print
> $$2;exit}' $$GENERATED_R_FILE`; \
>     mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
> *    cp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \*
> *      || exit 31; \*
>     cp $$GENERATED_R_FILE $(2) || exit 32; \
>   done;
> @# Ensure that the target file is always created, i.e. also in case we did
> not
> @# enter the GENERATED_R_FILE-loop above. This avoids unnecessary
> rebuilding.
> $(hide) touch $(2)
> endef
>
> When two or more unrelated modules depend on a module that needs to be
> compiled ç¼–by appt2, multiple files with the same name will be copied to the
> same directory.
> When the compilation time of these modules overlaps, the copy operation
> conflicts, which leads to the failure of the build
>
> We also check the aosp master, it may has the same issue
>
> B/R
> Raymond
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-building?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Building" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/5f6a6033-6620-40ae-a3dd-125c35f6b394n%40googlegroups.com
> <https://groups.google.com/d/msgid/android-building/5f6a6033-6620-40ae-a3dd-125c35f6b394n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CALQgHd%3DxTiUHRtZ02ntS6smJjuv9rum4AxV-tvd-676KyN5rcw%40mail.gmail.com.

Reply via email to