I am having an issue where my Android Studio project will not build when I go to downgrade it from Kotlin version 1.5.0 -> 1.4.32. When I do this Gradle will sync with no issues but all of my Kotlin code will be red (despite it being correct) and the autocomplete feature no longer works. If I reset my Kotlin version to 1.5.0 the code shows as error free and autocomplete works as intended but the project will still not build due to it not being supported with Compose Compiler. I have tried setting kotlinOptions to ignore this fact but that also gives me build errors. Any help on the matter would be greatly appreciated!
Asked
Active
Viewed 699 times
2
-
please refer to this doc: https://developer.android.com/jetpack/compose/setup – atyc May 24 '21 at 02:45
-
Compose doesn't support 1.5.0 yet check this for more details https://stackoverflow.com/questions/67600344/jetpack-compose-on-kotlin-1-5-0 – AgentP May 25 '21 at 14:29
-
And regarding the errors I would recommend you to invalidate caches and restart AS once – AgentP May 25 '21 at 14:29
-
@atyc I have followed the first party document but still can't build (shows Kotlin code as invalid syntax and features like auto complete do not work). I have invalidated the cache and restarted AS multiple times with no success either :( Anything just so I can continue working would be great I have been trying to resolve this for days now. I even opened a support ticket with Google. – Brandon Iceberg May 25 '21 at 23:46
-
Did you use Android Studio Arctic Fox? and try to build app from the command line by `./gradlew assembleDebug` – atyc May 27 '21 at 03:11
-
@atyc Yes I am running version: Android Studio Arctic Fox | 2020.3.1 Beta 2 Build #AI-203.7717.56.2031.7375522, built on May 18, 2021 Runtime version: 11.0.10+0-b96-7281165 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.3.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 16 Registry: ide.instant.shutdown=false, external.system.auto.import.disabled=true I haven't tried the manual build process but I will give it a shot. – Brandon Iceberg May 28 '21 at 20:32
1 Answers
1
This is probably not very recomended, however, it did fix my issue which appears to maybe be the same as yours.
I'm using 1.5.10
for the kotlin standard library in my app/build.gradle
and kotlinCompilerVersion
is set to 1.4.32
:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
. . .
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion composeVersion
kotlinCompilerVersion "1.4.32"
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.10"
. . .
}
But in my project's build.gradle
I'm using 1.4.32
:
buildscript {
ext {
composeVersion = "1.0.0-beta07"
kotlinVersion = "1.4.32"
accompanistVersion = "0.10.0"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0-beta03"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
. . .

Joshua King
- 3,450
- 1
- 17
- 19