Hello! I updated to 1.4.20, and now all my synthet...
# android
n
Hello! I updated to 1.4.20, and now all my synthetic views are highlighted red, without any code suggestion or quick documentation (it all builds and work fine though). How do I get the code completion back?
đź‘Ť 1
k
Try deleting the .gradle folder at your project root. I've seen this happen with older versions too...some sort of stale cache... This sometimes helps...
j
synthetics have been removed from kotlin 1.4.20
so you will have to either revert to 1.4.10
or use another solution
I'd suggest if you are in a hurry, use 1.4.10, but for the future you could perhaps use viewBinding
n
Thanks for the advice! Rolled back to 1.4.10 Gradle plugin, but the syntax is still all red. Maybe I need to rollback the IDEA plugin as well...
Rolled back IDEA plugin as well, it's still all red
Removed .gradle folder, restarted Android Studio - it's still red
j
invalidate caches
clean/rebuild
k
The plugin was not removed in 1.4.20. It got deprecated in favor of a more granular plugin that only supports Parcelize. However,
kotlin-android-extensions
plugin is still available and shouldn’t cause any problems. I have it in my project and it still works fine after updating to 1.4.20 But yea, try invalidate cache and restart. Hopefully that should help
k
Remove .idea in the project dir as well? This has happened in AS before kotlin 1.4.20 FYI
n
Invalidating cache didn't help
Clean/rebuild didn't help, rebuild failed on every extension function used on synthetic field
k
Can you share your build.gradle setup?
n
build.gradle.kts
I checked out the project from another computer, same result after rebuild IDEA Kotlin Plugin version: 1.4.20-release-Studio4.1-1 Gradle Kotlin Plugin version: 1.4.10
The changes applied in code via synthetic view references are completely missing from the app if the syntax is highlighted as red
k
Looks like you’re missing the androidExtensions configuration block. So it was probably working before as a result of an open bug that is now fixed. You need to add this block:
Copy code
androidExtensions {
  isExperimental = true
}
to turn on the view stuff
n
Added to
android
block this:
Copy code
androidExtensions {
    isExperimental = true
}
Cleaned project, invalidated cache. restarted IDE - the problem is still there
In my
settings.gradle.kts
I had this block:
Copy code
pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        jcenter()
        mavenCentral()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == "com.android" || requested.id.name == "kotlin-android-extensions") {
                useModule("com.android.tools.build:gradle:4.0.1")
            }
        }
    }
}
(I use KMM module, this block was in the generated template). I tried building with and without this block, but no success
k
Wow! That sucks. I have no idea what could be wrong The project still builds and works fine right? And you reverted all the changes, but the issue still persists?
n
It does build, but the changes done via synthetic views are ignored in the run
Reverting the changes didn't help, yes
k
In that plugin management, Kotlin Android extensions should be mapped to the kotlin plugin not AGP
n
And I managed to reproduce the issue on another laptop in the same project after I updated IDE's Kotlin Plugin
k
But you said reverting all changes doesn't help. So that's strange
Ahaa. This only happens if IDE plugin is upgraded to Kotlin 1.4.20?
Does it help if you revert IDE plugin to 1.4.10?
If yes, then perhaps best to should open an issue on youtrack, so Kolton team can look into it
I remember vaguely that I had some issues with 1.4.20 EAPs. But can't remember the details now. The stable plugin actually works fine for me
n
I will try to revert the plugin and see if it helps
Alas, this is IDE Plugin related issue - rollback to 1.4.10 works
k
Awesome! What version of AS are you using?
n
image.png
Actually, the problem is back there after Invalidating cache + restart
It seems like the synthetic fields stop working when I plug KMM module