admin管理员组

文章数量:1334908

I was trying to setup a Kotlin multiplatform project with the multiplatform wizard from JetBrains: , but when I tried to run the app on the emulator I get this error:

copyNonXmlValueResourcesForCommonMain task was failed:
.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.

I was trying to setup a Kotlin multiplatform project with the multiplatform wizard from JetBrains: https://kmp.jetbrains, but when I tried to run the app on the emulator I get this error:

copyNonXmlValueResourcesForCommonMain task was failed:
.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.

Share Improve this question edited Nov 21, 2024 at 6:22 Sajeg asked Nov 20, 2024 at 18:38 SajegSajeg 735 bronze badges 2
  • When you create a copy of your project files (not just renaming the folder, an actual duplication of all files) and try to build that project instead, does that also fail with the same error? – tyg Commented Nov 20, 2024 at 18:58
  • Please add the solution as an answer and mark it as answered – Luke Worth Commented Nov 21, 2024 at 3:40
Add a comment  | 

1 Answer 1

Reset to default 3

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

本文标签: androidSolved Kotlin multiplatform Gradle build faild with Invaild Timestamp ErrorStack Overflow