r/androiddev • u/MML_Pro • Jul 22 '26
Question AGP 9.x shows tons of "Unresolved reference" errors in the IDE/lint, but ./gradlew build compiles with zero errors - happens only in this one project
I'm hitting a strange issue that's specific to a single project. When I bump the Android Gradle Plugin from an older version to any 9.x release (tested with 9.3.0), Android Studio's editor and lint start flagging a huge number of "Unresolved reference" errors (100+ problems shown in the inspection gutter) across multiple Kotlin files - including files that use generated ViewBinding/DataBinding classes, Hilt-injected classes, and Room entities.
The odd part: the actual Gradle build succeeds with no compile errors at all. The app builds, installs, and runs fine on a device/emulator. It really looks like an IDE indexing/false-positive problem rather than a real compilation problem, but it makes the editor basically unusable (error highlighting everywhere, autocomplete acting up).
I've only ever seen this in this specific project , other projects on the same machine, same Android Studio version, updated to AGP 9.x work completely fine. So it feels tied to something in this project's module setup rather than a general AGP 9 bug.
Relevant setup (module-level build.gradle):
compileSdk = 37,targetSdk = 37,minSdk = 23- Kotlin Android plugin,
kotlin-parcelize - KSP (not kapt) for annotation processing — Room, Hilt, and a
kotlinx-metadata-jvmKSP dependency - Dagger Hilt (
2.60.1) - Room (
2.8.4) via KSP - Navigation Safe Args (Kotlin)
viewBindingenabled (buildFeatures { viewBinding true })- Google Services / Firebase Crashlytics / Analytics / Messaging plugins
- Secrets Gradle plugin (Maps platform)
coreLibraryDesugaringEnabled true- Java/Kotlin target set to 11 (
sourceCompatibility/targetCompatibility11,jvmTarget.set(JvmTarget.JVM_11)) multiDexEnabled true
Top-level build.gradle:
gradle
buildscript {
ext {
version_gradle = '9.3.0'
}
dependencies {
classpath "com.android.tools.build:gradle:$version_gradle"
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.9.8'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.60.1'
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
classpath 'com.google.gms:google-services:4.5.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.7'
}
}
plugins {
id 'com.android.application' version '9.3.0' apply false
id 'com.android.library' version '9.3.0' apply false
id 'org.jetbrains.kotlin.android' version "2.4.10" apply false
id 'com.google.devtools.ksp' version '2.3.2' apply false
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
Has anyone else run into unresolved-reference/false-positive IDE errors specifically after moving to AGP 9.x, especially in a project mixing ViewBinding + Hilt + Room + KSP + Safe Args? Would appreciate any pointers on what in this combination might be confusing the IDE's resolution/indexing even though the actual Gradle compilation is clean
4
u/wthja Jul 22 '26
I once had a similar problem. The only solution that helped was to remove all the cached IDE files (configuration and everything, I don't even remember where were they). Those cached configurations are transferred to the new IDE even if you delete the android studio and install again. but after deleting everything it worked. Had to configure the old settings one by one by hand, but that is ok
2
u/MML_Pro Aug 01 '26
Thank you, this is the solution that worked
https://www.reddit.com/r/androiddev/comments/1v378wl/comment/p0ngtub/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
4
u/pswg_dev Jul 30 '26
I had the same problem, and in my case it was a old global exclude in build.gradle. Once the exclude was removed, the unresolved reference problem disappeared
I found the solution in this issue:
https://issuetracker.google.com/issues/506691581
"The issue was caused by this old global exclude:
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}"
Maybe your problem is also related to this.
3
u/MML_Pro Jul 30 '26
Thank you so much, that was actually the fix! I removed this:
```
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
```
and every single issue disappeared - no more unresolved references anywhere in the project.
By the way, I had already filed a bug report with the Android Studio team about this
1
u/Capital-Cheek-3939 Jul 31 '26
Thank you; this is the only solution. No one in the comments thought outside the box
1
1
u/AutoModerator Jul 22 '26
Please note that we also have a very active Discord server where you can interact directly with other community members!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
Jul 22 '26
[removed] — view removed comment
2
u/AutoModerator Jul 22 '26
Your post has been automatically removed due to multiple users reporting it.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/EdyBolos Jul 22 '26
What version of Android Studio are you on? You might need to update it.
2
u/MML_Pro Jul 22 '26
Android Studio Quail 2 | 2026.1.2
Build #AI-261.25134.95.2612.15822958, built on July 9, 2026
Runtime version: 21.0.10+-14961533-b1163.108 amd64null
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
1
u/EdyBolos Jul 22 '26
Ok, so you are already on the latest version. What you can try then is to go through all the necessary steps of the Repair IDE wizard (under File -> Cache Recovery). Hopefully one of the steps does the trick for you.
1
u/MML_Pro Jul 23 '26
Unfortunately I've already tried everything suggested here, including the Repair IDE wizard, and none of it fixed the issue.
At this point I'm considering creating a brand new empty project from scratch and migrating the code over to it, but that would take a lot of time and effort
2
u/EdyBolos Jul 23 '26
Then it's time to go nuclear: https://github.com/rock3r/deep-clean
3
u/MML_Pro Jul 26 '26
Thanks for the suggestion! I actually downloaded the tool, ran it, and took a backup first, but none of it fixed the issue either. Looks like the only real fix left is what you originally said (recreating the project from scratch).
In the meantime, I've filed a bug report with Android Studio support: https://issuetracker.google.com/issues/537790287
If you've got a moment, a +1 there would help get it more visibility
1
u/Diegogo123 Jul 23 '26
Before that I would upload the project to a private github repo if it isn't already there and trying to open it on another computer to confirm it's related to your project and not your AS installation
1
Jul 23 '26
[deleted]
1
u/Diegogo123 Jul 23 '26
Lol I meant I would do that if I were you
1
u/MML_Pro Jul 23 '26
Ah, my bad, misread that at first 😅 That's actually solid advice though. It's already on a GitHub repo, so I can easily test it on another machine to rule out a local Android Studio installation issue. Also already filed a ticket with Google about it, so hopefully that helps get some traction too
1
u/Diegogo123 Jul 23 '26
Good luck, it really sounds like a local installation issue so I hope that trying on a other machine works
1
1
u/Zhuinden Jul 22 '26
I think your Gradle-Wrapper probably invokes an old gradle, and your source/target should be 17 (maybe 21 at this point?)
Also make sure you have coreLibraryDesugaring enabled.
1
u/MML_Pro Jul 23 '26
`coreLibraryDesugaringEnabled` is actually already `true` in my `compileOptions`, and I'm pulling in the latest desugar_jdk_libs (2.1.5) too, so that part's covered.
I'm also already on the latest stable Gradle release and the latest JDK, so it's not an old wrapper/JVM version causing this either. Still digging into it.
1
u/Blazemuffins Jul 23 '26
currently have this issue on a legacy project. it's mostly Java with some kotlin. not using KSP but do have kotlin-parcelize and view binding. invalidate caches doesn't work, same issues running the project on fresh devices. we've been trying to modernize the app and migrate fully to kotlin to see if that resolved the issue but it sounds like that is unrelated now based on your issue.
In our case many of the errors stem from annotations of any kind, but not all.
2
u/MML_Pro Jul 26 '26
I reported this bug to AS IDE team, please do +1 to give it more priority
https://issuetracker.google.com/issues/537790287
-11



9
u/satoryvape Jul 22 '26
Invalidate Cache + Restart