Assigned
Status Update
Comments
ja...@google.com <ja...@google.com>
ya...@google.com <ya...@google.com>
ya...@google.com <ya...@google.com> #2
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
an...@gmail.com <an...@gmail.com> #3
Our projects are on GitLab.com. Is there a means of private communication where I could give you temporary access to the upstream KMP library project and also the downstream Android library project where the IDE problems are?
an...@gmail.com <an...@gmail.com> #4
I used the "Repair IDE" feature and after recovery step 3 there is an IDE error. I just now submitted the report from the IDE:
com.intellij.diagnostic.PluginException: Cannot create editor by provider com.android.tools.idea.editors.manifest.GradleManifestEditorProvider [Plugin: org.jetbrains.android]
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1.invokeSuspend(EditorCompositeModelManager.kt:139)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)
Caused by: java.lang.AssertionError
at com.android.tools.idea.editors.manifest.GradleManifestEditorProvider.createEditor(GradleManifestEditorProvider.java:55)
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1$editor$1.invokeSuspend$lambda$0(EditorCompositeModelManager.kt:127)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction$lambda$1$lambda$0(coroutines.kt:329)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction$lambda$1(coroutines.kt:329)
at com.intellij.openapi.progress.CoroutinesKt.blockingContextInner(coroutines.kt:341)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invokeSuspend(coroutines.kt:233)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:232)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction(coroutines.kt:328)
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1$editor$1.invokeSuspend(EditorCompositeModelManager.kt:126)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:221)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:117)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:675)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:573)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16$lambda$15(IdeEventQueue.kt:355)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:857)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16(IdeEventQueue.kt:354)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2$lambda$1(IdeEventQueue.kt:1045)
at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2(IdeEventQueue.kt:1045)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:1054)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:109)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1054)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18(IdeEventQueue.kt:349)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:395)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
com.intellij.diagnostic.PluginException: Cannot create editor by provider com.android.tools.idea.editors.manifest.GradleManifestEditorProvider [Plugin: org.jetbrains.android]
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1.invokeSuspend(EditorCompositeModelManager.kt:139)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)
Caused by: java.lang.AssertionError
at com.android.tools.idea.editors.manifest.GradleManifestEditorProvider.createEditor(GradleManifestEditorProvider.java:55)
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1$editor$1.invokeSuspend$lambda$0(EditorCompositeModelManager.kt:127)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction$lambda$1$lambda$0(coroutines.kt:329)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction$lambda$1(coroutines.kt:329)
at com.intellij.openapi.progress.CoroutinesKt.blockingContextInner(coroutines.kt:341)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invokeSuspend(coroutines.kt:233)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:232)
at com.intellij.openapi.application.CoroutinesKt.writeIntentReadAction(coroutines.kt:328)
at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManager$fileEditorWithProviderFlow$editorsWithProviders$1$1$1$editor$1.invokeSuspend(EditorCompositeModelManager.kt:126)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:221)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:117)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:675)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:573)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16$lambda$15(IdeEventQueue.kt:355)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:857)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16(IdeEventQueue.kt:354)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2$lambda$1(IdeEventQueue.kt:1045)
at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2(IdeEventQueue.kt:1045)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:1054)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:109)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1054)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18(IdeEventQueue.kt:349)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:395)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
an...@gmail.com <an...@gmail.com> #5
In my top-level KMP project (separate repo and project) from the Project view when I expand the "External Libraries" node, I see nodes which are JAR files, and also nodes labeled like "Gradle: com.foo:somelibrary:1.0.0" and this project looks just fine in the IDE. Everything works.
By contrast, in my downstream Android library project, I only see JAR nodes and I DO NOT see any node starting with "Gradle: com.foo:somelibrary:1.0.0". This makes me think that the project just can't resolve these Gradle dependencies on my machine. Again, this project builds on my machine and in GitLab CI using Gradle from the command line.
I should also add that I only started experiencing the IDE problem after creating a brand new KMP project and then trying to consume it as an AAR dependency from within my Android library project. Originally I had no problems with the "Hello World" version of the KMP project and I gradually hoisted up more dependencies into the Android source set. Things were working for awhile but then stopped working for no apparent reason (to me).
This has stopped my work since I can't use code-complete or do any reasonable development. I'm more than happy to pair, tail the IDE logs, or whatever can be of help. Thanks!
By contrast, in my downstream Android library project, I only see JAR nodes and I DO NOT see any node starting with "Gradle: com.foo:somelibrary:1.0.0". This makes me think that the project just can't resolve these Gradle dependencies on my machine. Again, this project builds on my machine and in GitLab CI using Gradle from the command line.
I should also add that I only started experiencing the IDE problem after creating a brand new KMP project and then trying to consume it as an AAR dependency from within my Android library project. Originally I had no problems with the "Hello World" version of the KMP project and I gradually hoisted up more dependencies into the Android source set. Things were working for awhile but then stopped working for no apparent reason (to me).
This has stopped my work since I can't use code-complete or do any reasonable development. I'm more than happy to pair, tail the IDE logs, or whatever can be of help. Thanks!
an...@gmail.com <an...@gmail.com> #6
After manually copy-pasting batches of classes to a brand new Android library project and building after each update, I discovered the cause of this problem and was able to resolve it.
The underlying problem was the inclusion of a custom Mockito agent in `build.gradle.kts` to support JDK 21+ based on this Mockito documentation:
https://javadoc.io/static/org.mockito/mockito-core/5.14.2/org/mockito/Mockito.html#0.3
Bumping to newer versions of Mockito did not resolve the problem, but commenting out those 3 blocks of code instantly fixed the IDE.
Looking at Git history, I added those Mockito changes about 6 weeks ago, and they had been working since then, including after I introduced my new upstream KMP artifact as a dependency for the Android library. Since the changes were made, I had updated Kotlin from 2.1.0 to 2.1.10 and also updated Android Studio versions from Ladybug up to Meerkat Canary, RC, and finally Stable.
It seems the Mockito code snippet is not working with the Gradle sync in Android Studio. Once the issue was fixed, then I started seeing "Gradle: com.foo:somelibrary:1.0.0" nodes once again (as noted in Comment 5 of this bug) and then the IDE was able to resolve the Gradle dependencies.
If there's interest in reproducing this problem by iteratively checking out commit hashes, I'd be happy to pair with someone.
The underlying problem was the inclusion of a custom Mockito agent in `build.gradle.kts` to support JDK 21+ based on this Mockito documentation:
Bumping to newer versions of Mockito did not resolve the problem, but commenting out those 3 blocks of code instantly fixed the IDE.
Looking at Git history, I added those Mockito changes about 6 weeks ago, and they had been working since then, including after I introduced my new upstream KMP artifact as a dependency for the Android library. Since the changes were made, I had updated Kotlin from 2.1.0 to 2.1.10 and also updated Android Studio versions from Ladybug up to Meerkat Canary, RC, and finally Stable.
It seems the Mockito code snippet is not working with the Gradle sync in Android Studio. Once the issue was fixed, then I started seeing "Gradle: com.foo:somelibrary:1.0.0" nodes once again (as noted in Comment 5 of this bug) and then the IDE was able to resolve the Gradle dependencies.
If there's interest in reproducing this problem by iteratively checking out commit hashes, I'd be happy to pair with someone.
ya...@google.com <ya...@google.com> #7
Over to Gradle team to take a look.
It looks like configuring Mockito for Java 21+ per
val mockitoAgent = configurations.create("mockitoAgent")
dependencies {
testImplementation(libs.mockito)
mockitoAgent(libs.mockito) { isTransitive = false }
}
Description
####################################################
Please provide all of the following information, otherwise we may not be able to route your bug report.
####################################################
1. Describe the bug or issue that you're seeing.
The IDE shows every import statement in red, with a tooltip error message, "Unresolved reference ..."
2. Attach log files from Android Studio
2A. In the IDE, select the Help..Collect Logs and Diagnostic Data menu option.
2B. Create a diagnostic report and save it to your local computer.
2C. Attach the report to this bug using the Add attachments button.
3. If you know what they are, write the steps to reproduce:
3A. Do a fresh clone of the project into a brand new directory.
3B. Either open Android Studio, wait for the sync, and build; or build first from the terminal then open Android Studio.
3C. I have tried Invalidate Caches and Restart, Repair IDE, deleting the project-level .idea folder, deleting my machine-level Gradle caches, etc.
3D. When I only delete the project-level .idea folder then do Invalidate Caches and Restart, the IDE quickly freezes upon restart.
In addition to logs, please attach a screenshot or recording that illustrates the problem.
For more information on how to get your bug routed quickly, see
Build: AI-243.22562.218.2431.13114758, 202502242015
AS: Meerkat | 2024.3.1
AI-243.22562.218.2431.13114758, JRE 21.0.5+-12932927-b750.29x64 JetBrains s.r.o., OS Mac OS X(aarch64) v15.3.1, screens 3840x2160 (100%)
Android Gradle Plugin: (plugin information not found)
Gradle: 8.11.1
Gradle JDK: JetBrains Runtime 21.0.5 - aarch64
NDK: from local.properties: (not specified), latest from SDK: 27.1.12297006
CMake: from local.properties: (not specified), latest from SDK: 3.30.5-g0033d09, from PATH: 3.31.5
```