Closed skolson closed 8 months ago
Could you attach a project in which you reproduce the issue?
The project this is happening on is large, has non-public dependencies and is not on Github, so would not be workable for either of us. I will try out a smaller project on rc03, if it happens there I can post that on Github even though that project is a very early work-in-progress. Are there any diagnostics or gradle options/logs I can try to get more info when the error occurs?
I'm wondering if this has something to do with a Duplicate content roots detected
warning I get on this project at end of sync. Here is a snippet from the last fail (using rc03) from idea.log. I added blank lines around the suspect stuff:
2024-02-23 15:52:09,407 [20933606] INFO - #o.j.p.g.s.e.GradleExecutionHelper - Passing command-line to Gradle Tooling API: --init-script D:\Temp\ijMapper1.gradle -Didea.gradle.download.sources=true -Didea.sync.active=true -Didea.resolveSourceSetDependencies=true -Porg.gradle.kotlin.dsl.provider.cid=832530945911400 --init-script D:\Temp\sync.studio.tooling3.gradle -Djava.awt.headless=true --continue --stacktrace -Pandroid.injected.build.model.only=true -Pandroid.injected.build.model.only.advanced=true -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.build.model.only.versioned=3 -Pandroid.studio.version=233.14475.28.2331.11456607 -Pandroid.injected.build.model.disable.src.download=true -Pidea.gradle.do.not.build.tasks=false -Pandroid.injected.avoid.task.registration=false -Dorg.gradle.internal.GradleProjectBuilderOptions=omit_all_tasks -Pkotlin.mpp.enableIntransitiveMetadataConfiguration=true --init-script D:\Temp\ijInit1.gradle -Didea.active=true -Didea.version=2023.3 -Didea.vendor.name=Google
2024-02-23 15:52:52,065 [20976264] WARN - #c.i.o.p.i.j.JdkAuto - Multiple SdkType candidates [JavaSDK, Android SDK]. Proceeding with a first candidate: JavaSDK
2024-02-23 15:52:52,066 [20976265] INFO - #c.i.o.p.i.j.JdkAuto - Looking for a local SDK for JDK with name SdkLookup{JDK, name=17}
2024-02-23 15:52:52,673 [20976872] INFO - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder$SyncStateUpdater - onSuccess(RESOLVE_PROJECT:9)
2024-02-23 15:52:52,673 [20976872] INFO - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder - Started setup of project 'Monay2'.
2024-02-23 15:52:52,678 [20976877] INFO - #o.j.k.i.g.s.r.GradleBuildRootIndex - D:/WorkingShared/Monay2: org.jetbrains.kotlin.idea.gradleJava.scripting.roots.Imported@3c6768fa -> org.jetbrains.kotlin.idea.gradleJava.scripting.roots.Imported@c689906
2024-02-23 15:52:52,688 [20976887] INFO - #c.i.o.e.u.ExternalSystemUtil - External project [D:/WorkingShared/Monay2] resolution task executed in 43397 ms.
2024-02-23 15:52:52,698 [20976897] INFO - #c.i.o.e.s.p.IdeModifiableModelsProviderImpl - Ide modifiable models provider, create builder from version 72
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: com.ionspin.kotlin:bignum-jvm:0.3.9'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.3'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.9.22'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlinx:atomicfu-jvm:0.23.2'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.8.0'
2024-02-23 15:52:52,722 [20976921] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.junit.platform:junit-platform-engine:1.10.2'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.junit.platform:junit-platform-commons:1.10.2'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.junit.jupiter:junit-jupiter-engine:5.10.2'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.junit.jupiter:junit-jupiter-api:5.10.2'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.jetbrains:annotations:23.0.0'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.opentest4j:opentest4j:1.3.0'
2024-02-23 15:52:52,723 [20976922] WARN - #c.i.o.e.s.p.m.LibraryDataService - Multiple project level libraries found with the same name 'Gradle: org.apiguardian:apiguardian-api:1.1.2'
**2024-02-23 15:52:52,821 [20977020] WARN - #c.i.o.e.s.p.m.ContentRootDataService - Duplicating content roots detected.**
2024-02-23 15:52:52,821 [20977020] WARN - #c.i.o.e.s.p.m.ContentRootDataService - Path [D:/WorkingShared/Monay2/monayCommon/src/commonMain/resources] of module [Monay2.androidApp.main] was removed from modules [Monay2.monayCommon.commonMain]
2024-02-23 15:52:52,821 [20977020] WARN - #c.i.o.e.s.p.m.ContentRootDataService - Path [D:/WorkingShared/Monay2/androidApp/src/main/res] of module [Monay2.androidApp.main] was removed from modules [Monay2.androidApp.androidTest]
2024-02-23 15:52:52,821 [20977020] WARN - #c.i.o.e.s.p.m.ContentRootDataService - Path [D:/WorkingShared/Monay2/uiCommon/src/commonTest/composeResources] of module [Monay2.uiCommon.commonTest] was removed from modules [Monay2.uiCommon.unitTest]
2024-02-23 15:52:52,821 [20977020] WARN - #c.i.o.e.s.p.m.ContentRootDataService - Path [D:/WorkingShared/Monay2/uiCommon/build/generated/compose/resourceGenerator/commonAndroidComposeResources] of module [Monay2.uiCommon.main] was removed from modules [Monay2.uiCommon.unitTest, Monay2.uiCommon.androidTest]
2024-02-23 15:52:52,881 [20977080] INFO - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder$DataImportListener - onImportFailed(D:/WorkingShared/Monay2)
2024-02-23 15:52:52,882 [20977081] INFO - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder$SyncStateUpdaterService - stopTrackingTask(D:/WorkingShared/Monay2)
2024-02-23 15:52:52,882 [20977081] INFO - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder$SyncStateUpdaterService - stopTrackingTask(RESOLVE_PROJECT:9)
2024-02-23 15:52:52,882 [20977081] WARN - #com.android.tools.idea.gradle.project.sync.GradleSyncStateHolder - Gradle sync failed in 43 s 587 ms. Failed to import project structure
2024-02-23 15:52:52,912 [20977111] INFO - #c.i.o.p.DumbServiceImpl - enter dumb mode [Monay2]
2024-02-23 15:52:52,918 [20977117] INFO - #com.google.services.firebase.insights.config.FirebaseAppManager - New app states: {Module: 'Monay2.androidApp'=FirebaseApp(connections=[CrashlyticsVariantConnection(connection=CrashlyticsConnection(appId=PLACEHOLDER, mobileSdkAppId=, projectId=, projectNumber=), variantData=VariantData(module=Module: 'Monay2.androidApp', variantName=All), isConfigured=false)])}.
2024-02-23 15:52:52,920 [20977119] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) com.android.tools.idea.res.AndroidProjectRootListener$MyDumbModeTask@48f133f9
2024-02-23 15:52:52,921 [20977120] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) com.android.tools.idea.res.AndroidProjectRootListener$MyDumbModeTask@48f133f9
2024-02-23 15:52:52,928 [20977127] INFO - #c.i.w.i.i.EntitiesOrphanageImpl - Update orphanage. 0 modules added
2024-02-23 15:52:52,968 [20977167] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) com.android.tools.idea.res.AndroidProjectRootListener$MyDumbModeTask@21792409
2024-02-23 15:52:52,969 [20977168] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) com.android.tools.idea.res.AndroidProjectRootListener$MyDumbModeTask@21792409
2024-02-23 15:52:53,017 [20977216] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) com.intellij.util.indexing.UnindexedFilesScanner$2@7fe637a
2024-02-23 15:52:53,017 [20977216] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) com.intellij.util.indexing.UnindexedFilesScanner$2@7fe637a
2024-02-23 15:52:53,017 [20977216] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: UnindexedFilesScanner[Monay2, 2 iterators]
2024-02-23 15:52:53,018 [20977217] INFO - #c.i.u.i.UnindexedFilesScanner - Started scanning for indexing of Monay2. Reason: changes in: "External roots from entity (compose-gradle-plugin-1.6.0-rc03.jar; empty; empty; empty)", "External roots from entity (classes; empty; empty; empty)"
2024-02-23 15:52:53,018 [20977217] INFO - #c.i.u.i.UnindexedFilesScanner - Performing delayed pushing properties tasks for Monay2 took 0ms; general responsiveness: ok; EDT responsiveness: ok
2024-02-23 15:52:53,018 [20977217] INFO - #c.i.u.i.UnindexedFilesScanner - Scanning of Monay2 uses 47 scanning threads
2024-02-23 15:52:53,022 [20977221] INFO - #c.i.o.p.DumbServiceImpl - exit dumb mode [Monay2]
2024-02-23 15:52:53,229 [20977428] INFO - #c.i.u.i.UnindexedFilesScanner - Scanning completed for Monay2. Number of scanned files: 2315; number of files for indexing: 0 took 211ms; general responsiveness: ok; EDT responsiveness: ok
2024-02-23 15:52:53,229 [20977428] INFO - #c.i.u.i.PerProjectIndexingQueue - Finished for Monay2. No files to index with loading content.
2024-02-23 15:52:53,230 [20977429] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: UnindexedFilesScanner[Monay2, 2 iterators]
I will try to resolve the content root duplications (the first two or so of those are leftovers from the resource scheme in use before changing to Compose Multiplatform resource support, and post the results.
Ok, tried a different small project using Compose Multiplatform rc03 and the same environment as the big project, and sync there works fine but also does not display the Android Studio warning box bottom-right warning about Duplicate content roots. Unfortunately it does not use compose resources either. Don't know if this is useful info, but I guess bottom line is I still don't have a project I can send you that recreates the issue. I'm gonna try to look in the source of the compose gradle plugin and see if I can tell what specifically is causing this error. I can't use anything newer than beta02 on my large project until this is resolved.
Still looking, but wanted to post that I just got a successful sync by deleting .idea directory, invalidating cache and restarting Android Studio. Saw similar errors mentioned in StackOverflow in other situations where invalidating cache fixed similar "removeContentEntry" errors, so tried it out and it worked. Don't know what's different between beta02 and rc0x that requires a cache invalidate.
But now a build is no longer seeing the composeResources subdirectory that worked in beta02. In beta02 the generated Res object had entries for each of the images in the drawable subdirectory. Under rc03 the generated Res object source has nothing in it for the drawables. Still looking.
I think this can be closed, I can no longer recreate the error since the cache invalidate.
I have the same problem in configuration compose-resources 1.6.11
and Android Studio Koala 2024.1.1
.
With compose-resources 1.6.2
everything works fine, but after update version to 1.6.11 Android Studio got the error removeContentEntry: removed content entry url '.../src/commonMain/composeResources' still exists after removing
.
Surprisingly, from terminal build works fine and correct ./gradlew assembleRelease
.
So I decided to downgrade Android Studio to Jellyfish 2023.3.1 Patch 2
and it helps, compose-resources 1.6.11
now works fine.
So I guess the problem in Android Studio Koala 2024.1.1
Summarize:
@comm1x try this:
1) close your AndroidStudio
2) delete .idea
directory
3) open the AndroidStudio
4) open the project from a scratch (don't use recents projects!)
confirming @terrakok's solution. I don't know why but it wasn't even related to compose multiplatform. My project is not using it.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
After upgrading Compose Multiplatform from beta2 to rc03 and attempting a sync, the sync works. but during post-sync processing this error occurs:
There is no call stack or other console messaging.
Environment: Windows 11 64 bit on AMD Android Studio Jellyfish Canary 10 Gradle 8.6 Kotlin 1,9,22
In this project, uiCommon is the module name for the Compose Multiplatform code. The new compose resources support is used only for a few PNG icons in the drawable subdirectory. The directory in the error messages contains the standard drawables subdirectory along with others.
This error causes the sync to fail even though the gradle build portion of the sync succeeds. The error indicates an attempt to delete a directory that to me should NOT BE deleted as it contains the source for the drawables in use during the build.
Switching back to beta02 causes the sync to succeed without error. RC01, RC02 and RC03 all get the error, so bug starts with rc01.