A couple of days ago I wanted to add a new dependency, the AWS SDK, to my Jetpack Compose app— and suddenly everything came to a full stop.
What looked like an easy-to-fix error message turned into a chain of errors that had to be solved one by one. It literally felt like I had opened Pandora’s box and was struggling to close it again.
Kotlin Update
Let’s start with the first error message right after adding the dependency and trying to compile again.
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.This error occurs when the version of Kotlin used to compile a module differs from the Kotlin version specified in your project’s build.gradle.
To fix this, update the Kotlin version specified in build.gradle to match the version used to compile the module.
In the project build.gradle I changed
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21”to
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10”However, that was an older project I created a year ago.
When I create a new project today, the structure of build.gradle is different:
buildscript {
...
}
plugins {
...
id 'org.jetbrains.kotlin.android' version '1.5.21' apply false
}
...Here, I would make the following change:
id 'org.jetbrains.kotlin.android' version '1.7.10' apply falseOne down. On to the next.
Gradle Update
Hoping everything was fine again, I tried to compile but got this message:
Minimum supported Gradle version is 7.5. Current version is 7.2.That seemed straightforward— or so I thought. Surfing Stack Overflow provided numerous fixes and I wasn’t sure which to use. I tried the simplest solution marked as accepted: invalidating the caches.

After Android Studio restarted I tried to build again and got a different error message.
Android Studio Update
The problem seemed bigger. While coding over those months, I had neglected my development environment. The result was this error while compiling:
This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2021.2.1 or newer.Yes— my version of Android Studio was out of date.

After checking for updates and installing the latest version, I got a version that was only released a couple of days ago. I couldn’t get any newer than that.

The dialog for clearing the caches also gained a few more options.

You might have guessed— it was not the end. The story goes on.
Upgrading the Build Files
The next error revealed itself as:
Caused by: org.gradle.api.GradleException: Compilation error. See log for more detailsUnfortunately, there wasn’t any other message to point me in the right direction.
So I changed the structure of the build.gradle to match the structure of new Jetpack Compose projects, hoping this would help. It was just a gut feeling, but it proved right.
That did not mean I was finished. That would have been too easy.
The next hoop to jump through:
Plugin [id: 'com.android.application', version: '7.4.0', apply: false] was not found in any of the following sources:I resolved this by adding the following block to settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}Changing Dependency Versions
Apparently I had missed a few things while refactoring the build.gradle files.
The next error said I was missing my Dagger and Hilt plugin:
Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources:Easy fix. In the project build.gradle I added the corresponding dependency:
plugins {
...
id 'com.google.dagger.hilt.android' version '2.44.2' apply false
}Now the Jetpack Compose version seemed off:
e: This version (1.0.1) of the Compose Compiler requires Kotlin version 1.5.21 but you appear to be using Kotlin version 1.7.10 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).I checked the Compose-to -Kotlin compatibility map and decided to change the module build.gradle from
kotlinCompilerExtensionVersion = "1.0.1"to
kotlinCompilerExtensionVersion = "1.4.0"The next error indicated another dependency issue:
The compiler option dagger.hilt.android.internal.projectType is not a recognized Hilt option. Is there a typo?I had to increase the version number of all my dagger-hilt dependencies to the latest version, 2.44.2, in the app build.gradle.
While re-adding the Dagger-Hilt plugin after restructuring the build files, I had already used the latest version— hence the mismatch.
On to the next error …
Hey— wait a second! I was able to compile again.
The deployment to the simulator worked, the app came up and …
Boom!
My hopes were shattered with a runtime exception:
java.lang.IllegalArgumentException: CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`This originated from the class that contains all the navigation-related code of my application; a bit of SO-surfing validated my assumption.
So I updated another dependency in my project build.gradle, this time the one for navigation:
implementation 'androidx.navigation:navigation-compose:2.5.1'Compile! Deploy! Run!
It worked again!
What a journey. It cost me a lot of time to get the app compiling again. I really wonder how I could have avoided all this and prevented it from the beginning.
How do you keep your projects up to date? Do you actively check for new dependency versions, or do you hope that adding or updating dependencies won’t make the whole project burst into flames?
Usually I only have to increase a dependency version here or there, but this time was different— a real learning experience.
Feel free to answer in the comments. Any hints are highly appreciated.
Thank you for reading!