Yusuf I.
—You can avoid unexpected issues by keeping the Kotlin versions in your project updated, especially when updating Gradle versions.
Each Kotlin version has a minimum and maximum supported Gradle version and using incompatible versions may cause errors such as:
BUILD FAILED in 8s [!] Your project requires a newer version of the Kotlin Gradle plugin. Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle: ext.kotlin_version = '<latest-version>' Exception: Gradle task assembleDebug failed with exit code 1
When updating Kotlin to the latest version, update the Android Gradle plugin (AGP), Gradle, and the Java Development Kit (JDK) to avoid incompatibility issues.
First, open the project-level build.gradle
file located in the root of your project and update the plugins
block. The example below will update Kotlin to version 1.9.20:
plugins { id 'com.android.application' version '8.2.2' apply false id 'com.android.library' version '8.2.2' apply false id 'org.jetbrains.kotlin.android' version '1.9.20' apply false }
The lines containing com.android.application
and com.android.library
update the Android Gradle plugin.
Next, update Gradle by navigating to the gradle/gradle-wrapper.properties
file and changing the version number in the distributionUrl
. Here we’re using Gradle version 8.2:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
To update the JDK to use Java 17, open the app/build.gradle
file and update the following lines:
compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = '17' }
Finally, update the Gradle JDK in Android Studio Settings. Go to File (or Android Studio on macOS) > Settings > Build, Execution, Deployment > Build Tools > Gradle and change the “Gradle JDK” field to “17”.
For more information about the Android build system, visit https://developer.android.com/build.
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.