I was trying to setup a Kotlin multiplatform project with the multiplatform wizard from JetBrains: https://kmp.jetbrains.com, but when I tried to run the app on the emulator I get this error:
copyNonXmlValueResourcesForCommonMain task was failed:
org.gradle.api.GradleException: Invalid Timestamp -2785708036854 for 'file '/the_project_dir/composeApp/src/commonMain/composeResources/drawable''
I already tried to upgrade the gradle plugin to the newest version, but then I got a warning that kmp isn't tested with that AGP and Gradle version. I also tried making a clean build again.
Edit: I could actually fix it by touching the folder:
touch /the_project_dir/composeApp/src/commonMain/composeResources/drawable
I thought I already tried that...Well at least it's fixed now.
The Kotlin Multiplatform project generator has a corrupt file you can see using this command:
find sampleApp/app/src/commonMain/composeResources/drawable -exec stat {} \;
It has an impossible modified timestamp of 1901-12-13:
File: sampleApp/src/commonMain/composeResources/drawable
Size: 39 Blocks: 0 IO Block: 4096 directory
Device: 9,0 Inode: 1350753046 Links: 2
Access: (0775/drwxrwxr-x) Uid: ( 1000/ ben) Gid: ( 1000/ ben)
Access: 2025-01-08 13:30:43.745490549 -0500
Modify: 1901-12-13 15:45:52.000000000 -0500
Change: 2025-01-08 13:30:43.745490549 -0500
Birth: 2025-01-08 13:30:43.745490549 -0500
File: /home/ben/Code/ktor/kobold/kobold-sample-app/src/commonMain/composeResources/drawable/compose-multiplatform.xml
Size: 4513 Blocks: 16 IO Block: 4096 regular file
Device: 9,0 Inode: 1350753047 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ben) Gid: ( 1000/ ben)
Access: 2025-01-08 13:30:43.745490549 -0500
Modify: 2025-01-08 17:50:56.000000000 -0500
Change: 2025-01-08 13:30:43.745490549 -0500
Birth: 2025-01-08 13:30:43.745490549 -0500
touching the file clears the problem as OPs edit stated:
touch /the_project_dir/composeApp/src/commonMain/composeResources/drawable