Skip to content

Android: Broken Code Completion / Intellisense in Android Studio #55517

Closed as not planned

Description

@JunPG

Description

Code completion does not work since React Native version 0.81.0

  1. Tested against few version of Android Studio: Narwhal, Otter, Panda
  2. Tested against few version of React Native: 0.81.x, 0.82.x, 0.83.x, 0.84.x
  • Noticed that gradle-plugin [gradle-plugin-root] is missing from project hierarchy on the left in Android Studio, not sure whether it's due to change of recent AGP version

Steps to reproduce

  1. Run React Native CLI to initiate project, e.g: npx @react-native-community/cli@latest init AwesomeProject0803 --version 0.81.0
  2. Run yarn && yarn start
  3. Run yarn android at least once
  4. Open Android Studio & allow it to for gradle sync & indexing... etc
  5. In MainActivity or MainApplication, try either of following
    a. Try to access React Native source code via Command + click in MacOS
    b. type on code to trigger code completion, e.g: override func onCreate to see whether anything happen

React Native Version

0.83.1

Affected Platforms

Build - MacOS, Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 26.2
  CPU: (12) arm64 Apple M2 Pro
  Memory: 134.20 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: /Users/userA/Library/pnpm/node
  Yarn:
    version: 1.22.22
    path: /Users/userA/.yarn/bin/yarn
  npm:
    version: 10.9.2
    path: /Users/userA/Library/pnpm/npm
  Watchman: Not Found
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK:
    API Levels:
      - "30"
      - "35"
      - "36"
    Build Tools:
      - 35.0.0
      - 36.0.0
      - 36.1.0
    System Images:
      - android-36 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.29346.138.2531.14850935
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.0
    wanted: 20.1.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.84.0-rc.4
    wanted: 0.84.0-rc.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

-

MANDATORY Reproducer

https://github.com/JunPG/AwesomeProject0831

Screenshots and Videos

React Native 0.80.3

Image

React Native 0.83.1 (ReproducerApp)

Image

React Native 0.84.0-rc

Image

Activity

  1. lukechen-ct commented on Feb 12, 2026

    @lukechen-ct

    +1

  2. GODueol commented on Feb 26, 2026

    @GODueol

    In previous versions of AndroidStudio, disabling k2 mode temporarily solved the problem, but now that option is no longer available, there is no workaround.

  3. kading commented on Mar 9, 2026

    @kading

    You can still use -Didea.kotlin.plugin.use.k1=true in newer versions. I have the same problem in my project that uses react-native native turbomodules.

  4. kading commented on Mar 9, 2026

    @kading

    I get this error in my Android log:

    org.jetbrains.kotlin.utils.exceptions.KotlinIllegalArgumentExceptionWithAttachments: Error while resolving org.jetbrains.kotlin.fir.declarations.impl.FirRegularClassImpl 
    from RAW_FIR to STATUS
    current declaration phase RAW_FIR
    origin: Source
    session: class org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSourcesSession
    module data: class org.jetbrains.kotlin.analysis.low.level.api.fir.projectStructure.LLFirModuleData
    KaModule: class org.jetbrains.kotlin.idea.base.fir.projectStructure.modules.source.KaSourceModuleImpl
    platform: JVM (17)
    
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolverKt.handleExceptionFromResolve(LLFirModuleLazyDeclarationResolver.kt:231)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolverKt.access$handleExceptionFromResolve(LLFirModuleLazyDeclarationResolver.kt:1)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolver.lazyResolve(LLFirModuleLazyDeclarationResolver.kt:230)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirLazyDeclarationResolver.lazyResolveToPhase(LLFirLazyDeclarationResolver.kt:27)
    	at org.jetbrains.kotlin.fir.symbols.FirLazyDeclarationResolverKt$lazyResolveToPhase$1.invoke(FirLazyDeclarationResolver.kt:134)
    	at org.jetbrains.kotlin.fir.symbols.FirLazyDeclarationResolverKt$lazyResolveToPhase$1.invoke(FirLazyDeclarationResolver.kt:134)
    	at org.jetbrains.kotlin.fir.symbols.FirLazyDeclarationResolverKt.invokeLazyResolveToPhase(FirLazyDeclarationResolver.kt:213)
    	at org.jetbrains.kotlin.fir.symbols.FirLazyDeclarationResolverKt.lazyResolveToPhase(FirLazyDeclarationResolver.kt:134)
    	at org.jetbrains.kotlin.fir.symbols.impl.UtilsKt.resolvedStatus(Utils.kt:26)
    	at org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol.getResolvedStatus(FirClassLikeSymbol.kt:56)
    	at org.jetbrains.kotlin.analysis.api.fir.symbols.KaFirNamedClassSymbol.getModality(KaFirNamedClassSymbol.kt:297)
    	at org.jetbrains.kotlin.idea.searching.usages.KotlinK2SearchUsagesSupport.isOverridableBySymbol(KotlinK2SearchUsagesSupport.kt:363)
    	at org.jetbrains.kotlin.idea.searching.usages.KotlinK2SearchUsagesSupport.isInheritable(KotlinK2SearchUsagesSupport.kt:354)
    	at org.jetbrains.kotlin.idea.search.KotlinSearchUsagesSupport$SearchUtils.isInheritable(KotlinSearchUsagesSupport.kt:99)
    	at org.jetbrains.kotlin.idea.k2.codeinsight.hints.KotlinInheritorsCodeVisionProvider.getClassInheritors$lambda$0(KotlinInheritorsCodeVisionProvider.kt:70)
    	at com.intellij.psi.util.CachedValuesManager$NonPhysicalPsiHandlerProvider.compute(CachedValuesManager.java:222)
    	at com.intellij.psi.util.CachedValuesManager$NonPhysicalPsiHandlerProvider.compute(CachedValuesManager.java:215)
    	at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.kt:24)
    	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:299)
    	at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:37)
    	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:299)
    	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:113)
    	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:28)
    	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:300)
    	at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.kt:18)
    	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:208)
    	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:136)
    	at org.jetbrains.kotlin.idea.k2.codeinsight.hints.KotlinInheritorsCodeVisionProvider.getClassInheritors(KotlinInheritorsCodeVisionProvider.kt:69)
    	at org.jetbrains.kotlin.idea.k2.codeinsight.hints.KotlinInheritorsCodeVisionProvider.getVisionInfo(KotlinInheritorsCodeVisionProvider.kt:42)
    	at org.jetbrains.kotlin.idea.k2.codeinsight.hints.KotlinInheritorsCodeVisionProvider.getHint(KotlinInheritorsCodeVisionProvider.kt:83)
    	at com.intellij.codeInsight.hints.codeVision.CodeVisionProviderBase.computeForEditor(CodeVisionProviderBase.kt:68)
    	at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.collect$lambda$0$0(CodeVisionPass.kt:74)
    	at com.intellij.concurrency.ApplierCompleter.processArrayItem(ApplierCompleter.java:121)
    	at com.intellij.concurrency.ApplierCompleter.processArray(ApplierCompleter.java:221)
    	at com.intellij.concurrency.ApplierCompleter.helpOthers(ApplierCompleter.java:241)
    	at com.intellij.concurrency.ApplierCompleter.lambda$helpAll$3(ApplierCompleter.java:182)
    	at com.intellij.concurrency.ThreadContext.resetThreadContext(threadContext.kt:294)
    	at com.intellij.concurrency.ApplierCompleter.helpAll(ApplierCompleter.java:181)
    	at com.intellij.concurrency.ApplierCompleter.lambda$exec$0(ApplierCompleter.java:111)
    	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.tryRunReadAction(NestedLocksThreadingSupport.kt:901)
    	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1237)
    	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$2(ApplierCompleter.java:153)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:717)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:792)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:748)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:716)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:75)
    	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:164)
    	at com.intellij.concurrency.ApplierCompleter.lambda$wrapAndRun$1(ApplierCompleter.java:145)
    	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:259)
    	at com.intellij.concurrency.ApplierCompleter.wrapAndRun(ApplierCompleter.java:145)
    	at com.intellij.concurrency.ApplierCompleter.exec(ApplierCompleter.java:113)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
    Caused by: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalStateExceptionWithAttachments: Modules are inconsistent
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder.buildRawFirFileWithCaching$lambda$0(LLFirFileBuilder.kt:55)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.ModuleFileCacheImpl.fileCached$lambda$0(LLFirDeclrationsCacheForModule.kt:42)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.ModuleFileCacheImpl.fileCached$lambda$1(LLFirDeclrationsCacheForModule.kt:42)
    	at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.ModuleFileCacheImpl.fileCached(LLFirDeclrationsCacheForModule.kt:42)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder.buildRawFirFileWithCaching(LLFirFileBuilder.kt:24)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider.computeClassLikeSymbolByClassId(LLKotlinSourceSymbolProvider.kt:359)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider.access$computeClassLikeSymbolByClassId(LLKotlinSourceSymbolProvider.kt:69)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider$classLikeCache$1.invoke(LLKotlinSourceSymbolProvider.kt:112)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider$classLikeCache$1.invoke(LLKotlinSourceSymbolProvider.kt:112)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.caches.LLPsiAwareClassLikeSymbolCache._init_$lambda$0(LLPsiAwareClassLikeSymbolCache.kt:50)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.caches.FirThreadSafeCache.getValue(FirThreadSafeCache.kt:29)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.caches.FirCacheWithInvalidationKt.getNotNullValueForNotNullContext(FirCacheWithInvalidation.kt:36)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.caches.LLPsiAwareClassLikeSymbolCache.getSymbolByClassId(LLPsiAwareClassLikeSymbolCache.kt:70)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider.getClassLikeSymbolByClassIdAndDeclaration(LLKotlinSourceSymbolProvider.kt:131)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLKotlinSourceSymbolProvider.getClassLikeSymbolByClassId(LLKotlinSourceSymbolProvider.kt:118)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLModuleWithDependenciesSymbolProvider.getClassLikeSymbolByClassIdWithoutDependencies(LLModuleWithDependenciesSymbolProvider.kt:82)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.symbolProviders.LLModuleWithDependenciesSymbolProvider.getClassLikeSymbolByClassId(LLModuleWithDependenciesSymbolProvider.kt:78)
    	at org.jetbrains.kotlin.fir.scopes.impl.FirAbstractImportingScope.processClassifiersFromImportsByName(FirAbstractImportingScope.kt:54)
    	at org.jetbrains.kotlin.fir.scopes.impl.FirAbstractSimpleImportingScope.processClassifiersByNameWithSubstitution(FirAbstractSimpleImportingScope.kt:32)
    	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirTypeResolverImpl.resolveUserTypeToSymbol(FirTypeResolverImpl.kt:116)
    	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirTypeResolverImpl.resolveType(FirTypeResolverImpl.kt:393)
    	at org.jetbrains.kotlin.fir.resolve.transformers.FirSpecificTypeResolverTransformer.resolveType(FirSpecificTypeResolverTransformer.kt:116)
    	at org.jetbrains.kotlin.fir.resolve.transformers.FirSpecificTypeResolverTransformer.transformTypeRef(FirSpecificTypeResolverTransformer.kt:77)
    	at org.jetbrains.kotlin.fir.resolve.transformers.FirSpecificTypeResolverTransformer.transformTypeRef(FirSpecificTypeResolverTransformer.kt:35)
    	at org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer.transformUnresolvedTypeRef(FirDefaultTransformer.kt:31)
    	at org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer.transformUserTypeRef(FirDefaultTransformer.kt:43)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.transformAnnotationCall(AbstractFirSpecificAnnotationResolveTransformer.kt:328)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.transformAnnotationCall(AbstractFirSpecificAnnotationResolveTransformer.kt:323)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.transformAnnotationCall(AbstractFirSpecificAnnotationResolveTransformer.kt:44)
    	at org.jetbrains.kotlin.fir.expressions.FirAnnotationCall.transform(FirAnnotationCall.kt:44)
    	at org.jetbrains.kotlin.fir.visitors.FirTransformerUtilKt.transformInplace(FirTransformerUtil.kt:20)
    	at org.jetbrains.kotlin.fir.visitors.FirTransformerUtilKt.transformInplace-aLnlfrU(FirTransformerUtil.kt:28)
    	at org.jetbrains.kotlin.fir.declarations.impl.FirRegularClassImpl.transformAnnotations(FirRegularClassImpl.kt:102)
    	at org.jetbrains.kotlin.fir.declarations.impl.FirRegularClassImpl.transformAnnotations(FirRegularClassImpl.kt:31)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.transformAnnotationContainer(AbstractFirSpecificAnnotationResolveTransformer.kt:656)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.transformDeclaration(AbstractFirSpecificAnnotationResolveTransformer.kt:481)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirCompilerRequiredAnnotationsTargetResolver.rawResolve(LLFirCompilerAnnotationsLazyResolver.kt:305)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirCompilerRequiredAnnotationsTargetResolver.resolve$lambda$0$0(LLFirCompilerAnnotationsLazyResolver.kt:183)
    	at org.jetbrains.kotlin.fir.extensions.FirSwitchableExtensionDeclarationsSymbolProviderKt.withGeneratedDeclarationsSymbolProviderDisabled(FirSwitchableExtensionDeclarationsSymbolProvider.kt:119)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirCompilerRequiredAnnotationsTargetResolver.resolve(LLFirCompilerAnnotationsLazyResolver.kt:182)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirCompilerRequiredAnnotationsTargetResolver.doLazyResolveUnderLock(LLFirCompilerAnnotationsLazyResolver.kt:168)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirTargetResolver.performResolve$lambda$0(LLFirTargetResolver.kt:300)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider.withJumpingLockImpl(LLFirLockProvider.kt:310)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider.withJumpingLock(LLFirLockProvider.kt:236)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirTargetResolver.performResolve(LLFirTargetResolver.kt:296)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirTargetResolver.performAction(LLFirTargetResolver.kt:272)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirSingleResolveTarget.visitTargetElement(LLFirSingleResolveTarget.kt:36)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget.goToTarget(LLFirResolveTarget.kt:83)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget.goToTarget$lambda$2(LLFirResolveTarget.kt:76)
    	at org.jetbrains.kotlin.fir.resolve.transformers.plugin.AbstractFirSpecificAnnotationResolveTransformer.withFileAndFileScopes(AbstractFirSpecificAnnotationResolveTransformer.kt:510)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirCompilerRequiredAnnotationsTargetResolver.withContainingFile(LLFirCompilerAnnotationsLazyResolver.kt:148)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirTargetResolver.withFile(LLFirTargetResolver.kt:205)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget.goToTarget(LLFirResolveTarget.kt:76)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget.goToTarget(LLFirResolveTarget.kt:65)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget.visit(LLFirResolveTarget.kt:60)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirTargetResolver.resolveDesignation(LLFirTargetResolver.kt:268)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyResolver.resolve(LLFirLazyResolver.kt:35)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyResolverRunner.runLazyResolverByPhase(LLFirLazyResolverRunner.kt:29)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolver.lazyResolveTargets(LLFirModuleLazyDeclarationResolver.kt:146)
    	at org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolver.lazyResolve(LLFirModuleLazyDeclarationResolver.kt:228)
    
  5. felipesaggion commented on Mar 11, 2026

    @felipesaggion

    @kading's answer worked for me. Just put -Didea.kotlin.plugin.use.k1=true inside studio64.exe.vmoptions and you're good to go. Yet we're still waiting for a correction on k2.

  6. jsjeon commented on Mar 30, 2026

    @jsjeon

    Tested against few version of Android Studio: Narwhal, Otter, Panda

    Yeah, this aligned with: https://developer.android.com/studio/releases/past-releases/as-narwhal-feature-drop-release-notes#k2-mode-default

    You can still use -Didea.kotlin.plugin.use.k1=true in newer versions.

    Not sure which versions we're talking about, but in the upcoming version (Panda 3 and onward), Android Studio no longer supports K1 mode, and will unset this system property. (FYI, IntelliJ will do so too.)

    Caused by: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalStateExceptionWithAttachments: Modules are inconsistent
    

    and this is the point. K2 mode uses a new / stricter project structure. More discussion will be found at https://issuetracker.google.com/issues/494294075

  7. jsjeon commented on Mar 31, 2026

    @jsjeon

    Please take a look at https://issuetracker.google.com/issues/494294075#comment3

    My debugging so far indicates that there is indeed a problem about the project structure. While analyzing MainApplication under app, its super type, ReactApplication under ../node-modules/react-native/ReactAndroid needs to be analyzed, but FIR can't find the enclosing module for that. If it's a regular *Application from Android SDK, it would be a library module. But, somehow, the entire ../node-modules appears as part of source roots of the main app, leading the retrieval of ReactApplication to the source file, while that file doesn't belong to any module.

  8. Qdafengzi commented on Mar 31, 2026

    @Qdafengzi

    This issue is a lifesaver. We haven't found a solution for several days. Upgrading to the new architecture version of react native has too many problems

  9. elijahsanders152-stack commented on Mar 31, 2026

    @elijahsanders152-stack
  10. DHRUV-1000101 commented on Mar 31, 2026

    @DHRUV-1000101

    There is another workaround but its very annoying. You can mark node modules as excluded, this fixes the issue for me but this exclusion needs to be done after every gradle resync. Just right click on node modules (if not visible switch to project files view mode) folder and mark as excluded, with this method we dont need to disable k2 mode. If there is some way to permanently exclude node modules until it's officially resolved please let me know.

  11. jsjeon commented on Mar 31, 2026

    @jsjeon

    Oh, the OP of https://issuetracker.google.com/issues/494294075 refers to this issue as a similar issue, not their exact issue. Then, I left investigations in the wrong place. 🤦🏼

    You can mark node modules as excluded, this fixes the issue

    ^ Exactly. All sources under .../node-modules appear as source roots of the main app module, which causes all the resolutions to declarations inside that, including ReactApplication for example, goes to source resolution, while it's supposed to be other means, like dependency/binary resolution.

    To that end,

    Seems like a tooling issue

    I think so. Somewhere a module structure or gradle configuration is generated, we shouldn't add the entire .../node-modules.

  12. jsjeon commented on Apr 17, 2026

    @jsjeon

    FYI, filed https://youtrack.jetbrains.com/issue/KTIJ-38436

    Also, from the internal version of Android Studio, I can dump the project structure, and the culprit matches what I described at that YT ticket:

    MODULE                        : ReproducerApp.app.main
    ...
            ModuleTypeName                : JAVA_MODULE
    ...
            CONTENT_ENTRY                 : file:///.../AwesomeProject0831/ReproducerApp/node_modules
                NativeSource                  : file:///.../AwesomeProject0831/ReproducerApp/node_modules
            CONTENT_ENTRY                 : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/fbjni-0.7.0/prefab/modules/fbjni/include
                NativeHeader                  : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/fbjni-0.7.0/prefab/modules/fbjni/include
            CONTENT_ENTRY                 : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/react-android-0.83.1-debug/prefab/modules/jsi/include
                NativeHeader                  : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/react-android-0.83.1-debug/prefab/modules/jsi/include
            CONTENT_ENTRY                 : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/react-android-0.83.1-debug/prefab/modules/reactnative/include
                NativeHeader                  : file://<GRADLE>/caches/9.0.0/transforms/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/transformed/react-android-0.83.1-debug/prefab/modules/reactnative/include
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/ap_generated_sources/debug/out
                JavaSource                    : file://<PROJECT>/app/build/generated/ap_generated_sources/debug/out
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/autolinking/src/main/java
                JavaSource                    : file://<PROJECT>/app/build/generated/autolinking/src/main/java
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/autolinking/src/main/jni
                NativeSource                  : file://<PROJECT>/app/build/generated/autolinking/src/main/jni
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/res/resValues/debug
                JavaResource                  : file://<PROJECT>/app/build/generated/res/resValues/debug
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/source/buildConfig/debug
                JavaSource                    : file://<PROJECT>/app/build/generated/source/buildConfig/debug
            CONTENT_ENTRY                 : file://<PROJECT>/app/build/generated/source/codegen/java [-]
            CONTENT_ENTRY                 : file://<PROJECT>/app/src/debug [-]
            CONTENT_ENTRY                 : file://<PROJECT>/app/src/main
                JavaSource                    : file://<PROJECT>/app/src/main/java
                JavaResource                  : file://<PROJECT>/app/src/main/res
    

    That is, that NativeSource (pointing to ../../node_modules) is regarded as source entry, and then ReactApplication inside node_modules is used to resolve the usage of that declaration.

  13. webbin commented on Apr 22, 2026

    @webbin

    You can try using Android Studio Otter 3 Feature Drop | 2025.2.3. This version supports disabling K2 mode, which allows you to view Kotlin code normally without any errors and should fix the code completion issue.

    To disable it:
    Go to Settings/Preferences > Languages & Frameworks > Kotlin and uncheck "Enable K2 Kotlin Mode".

  14. Vikmanatus commented on May 16, 2026

    @Vikmanatus

    Thanks @larafmina2-beep, to automate this workaround you can update your android/app/build.gradle with the following :

    apply plugin: "com.android.application"
    apply plugin: "org.jetbrains.kotlin.android"
    apply plugin: "com.facebook.react"
    
    // Workaround for facebook/react-native#55517 — Android Studio loses Kotlin
    // code completion in RN 0.81+ unless node_modules is marked as Excluded in
    // the IDE module model. AS persists that exclusion in AdditionalModuleElements
    // inside the :app module iml, but Gradle sync deletes the file. We regenerate
    // it here on every Gradle configuration so the exclusion sticks across syncs.
    // Remove once #55517 is fixed upstream.
    def projectName = rootProject.name
    def asExclusionIml = new File(rootProject.projectDir, ".idea/modules/app/${projectName}.app.main.iml")
    def asExclusionContent = '''<?xml version="1.0" encoding="UTF-8"?>
    <module version="4">
      <component name="AdditionalModuleElements">
        <content url="file://$MODULE_DIR$/../../../../node_modules" dumb="true">
          <excludeFolder url="file://$MODULE_DIR$/../../../../node_modules" />
        </content>
      </component>
    </module>
    '''
    gradle.projectsEvaluated {
        asExclusionIml.parentFile.mkdirs()
        asExclusionIml.text = asExclusionContent
    }

    This regenerates the IDE module file marking node_modules as excluded on every Sync Project with Gradle Files, so code completion comes back without you having to right-click → Mark as Excluded each time.

    Notes:

    • The $MODULE_DIR$/../../../../node_modules path assumes the standard RN layout (node_modules one level above android/). Monorepo users will need to adjust the path.

    • Tested and working on Android Studio Panda 4 | 2025.3.4 Patch 1 with react-native 0.85.3

    Best regards

  15. jsjeon commented on May 19, 2026

    @jsjeon

    This is fixed in the next canary of Android Studio: https://issuetracker.google.com/issues/494294075#comment17

  16. react-native-bot commented on Nov 16, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  17. added
    Stale
    on Nov 16, 2026
  18. react-native-bot commented on Nov 23, 2026

    @react-native-bot
    Collaborator

    This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍Platform: AndroidStale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions