Gradle 同步失败:removeContentEntry:删除的内容条目 url '...' 删除后仍然存在
Posted
技术标签:
【中文标题】Gradle 同步失败:removeContentEntry:删除的内容条目 url \'...\' 删除后仍然存在【英文标题】:Gradle sync failed: removeContentEntry: removed content entry url '...' still exists after removingGradle 同步失败:removeContentEntry:删除的内容条目 url '...' 删除后仍然存在 【发布时间】:2021-05-18 17:23:58 【问题描述】:我的小项目出现 gradle 同步失败,这似乎非常罕见,因为谷歌没有找到任何相关信息。我得到错误:
Gradle sync failed: removeContentEntry: removed content entry url 'file://C:/Users/BenutzerA/IdeaProjects/EtikettenScanner1/app' still exists after removing (2 s 337 ms)
干净的构建没有帮助。 “使缓存无效/重新启动”没有帮助。 到目前为止,这似乎是唯一遇到此问题的项目。我切换到其他 3 个项目,它们都构建没有问题。
项目使用 Kotlin、android、Google-Services
有人给我提示吗?
idea.log 的一部分:
021-02-15 20:39:10,076 [4053612] WARN - e.project.sync.GradleSyncState - removeContentEntry: removed content entry url 'file://C:/Users/BenutzerA/IdeaProjects/EtikettenScanner1/app' still exists after removing
java.lang.IllegalStateException: removeContentEntry: removed content entry url 'file://C:/Users/BenutzerA/IdeaProjects/EtikettenScanner1/app' still exists after removing
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableRootModelBridgeImpl.removeContentEntry(ModifiableRootModelBridgeImpl.kt:209)
at com.android.tools.idea.gradle.project.sync.setup.module.common.ContentEntriesSetup.removeExistingContentEntries(ContentEntriesSetup.java:47)
at com.android.tools.idea.gradle.project.sync.setup.module.ndk.NdkModuleCleanupStep.cleanUpModule(NdkModuleCleanupStep.java:42)
at com.android.tools.idea.gradle.project.sync.idea.data.service.NdkModuleModelDataService.onModelNotFound(NdkModuleModelDataService.java:78)
at com.android.tools.idea.gradle.project.sync.idea.data.service.ModuleModelDataService.onModelsNotFound(ModuleModelDataService.java:64)
at com.android.tools.idea.gradle.project.sync.idea.data.service.ModuleModelDataService.importData(ModuleModelDataService.java:49)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.doImportData(ProjectDataManagerImpl.java:252)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:120)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:206)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:213)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populateProject(IdeaSyncPopulateProjectTask.java:66)
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.doPopulateProject(ProjectSetUpTask.java:95)
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.onSuccess(ProjectSetUpTask.java:65)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.handExecutionResult(ExternalSystemUtil.java:559)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.executeImpl(ExternalSystemUtil.java:539)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.lambda$execute$1(ExternalSystemUtil.java:373)
at com.intellij.openapi.project.DumbServiceHeavyActivities.suspendIndexingAndRun(DumbServiceHeavyActivities.java:21)
at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:185)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:373)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4.run(ExternalSystemUtil.java:644)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)```
【问题讨论】:
您使用什么 IDE 版本?您是否尝试过删除所有 IDE 相关数据(.iml 文件和 .idea 文件夹)并重新导入项目? @y.bedrov 删除这些文件帮助我解决了问题,现在可以正常工作了,非常感谢。我会记住这一点的!我的 IDE 版本:IntelliJ IDEA 2020.3.2(终极版),Build #IU-203.7148.57,构建于 2021 年 1 月 26 日 【参考方案1】:有解决方案帮了我:
通过终端构建针构建变体(例如 ./gradlew assembleRelease) 通过 android studio 将 build 变体更改为 needle 后(在本例中为 Release) 可能会帮助其他人【讨论】:
成功运行“gradlew assembleRelease”后,仍然没有显示构建变体并且项目同步仍然失败并出现同样的错误。在我的情况下,它试图发布的文件夹是从 git 签出的 CMake 项目文件夹,无论如何都不应该被删除。任何人都知道为什么 gradle 首先要尝试删除项目?以上是关于Gradle 同步失败:removeContentEntry:删除的内容条目 url '...' 删除后仍然存在的主要内容,如果未能解决你的问题,请参考以下文章
Android Studio 2.3 错误:“Gradle 同步失败:原因:services.gradle.org”