I'm using AndroidStudio and Kotlin. I've been fairly successful until now and pretty much all functionalities I wanted are working, except the cloud backup and integration with Supabase.
When I tried integrating it, I started getting the error as per the title. This appears as a yellow banner on top of the code in the file where I try installing/launching Supabase. The yellow banner reads "**Some Kotlin runtime libraries** and 29 other jars have an unsupported binary format", and on the right end of this banner there is a "No updates found" and two buttons 1) Downgrade all Kotlin runtime libraries and 2) Details.
Pressing the downgrade says "Automatic library version update for Maven and Gradle projects is currently unsupported. Please update your build scripts manually.".
Pressing the Details gives me a 32-item list of errors. Pretty much all of the errors have the same format. E.g. C:/Users/name/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-events-jvm/3.0.2/------/ktor-events-jvm-3.0.2.jar (2.0.0) - expected: 1.8.0 They all have either 2.0.0 or 2.1.0 in the parenthesis and all are expected 1.8.0.
These are the codes I currently have, below.
build.gradle (Project)
plugins {
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}
build.gradle (app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt' // Add this line for KAPT
}
android {
namespace 'com.name.liftpath'
compileSdk 33
defaultConfig {
applicationId "com.name.liftpath"
minSdk 29
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
viewBinding {
enabled = true
}
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.0'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.room:room-runtime:2.5.0'
kapt 'androidx.room:room-compiler:2.5.0'
implementation 'androidx.room:room-ktx:2.5.0' // Optional, for Kotlin coroutines support
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation(platform("io.github.jan-tennert.supabase:bom:3.0.3"))
implementation("io.github.jan-tennert.supabase:supabase-kt")
implementation("io.github.jan-tennert.supabase:postgrest-kt")
implementation("io.github.jan-tennert.supabase:auth-kt")
implementation("io.github.jan-tennert.supabase:realtime-kt")
}
What have I tried
I've tried pretty much everything I cold find written that resembled what I am going through, but perhaps the lack of technical knowledge is what got in the way of making it work.
In the project Gradle, I've tried adding the code below, as per another thread's suggestion. However I got an error with "classpath"
buildscript {
ext.kotlin_version = '1.8.0'
repositories{
google()
mavenCentral()
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1' // downloads 1.7.1 Metadata
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // <= 1.5.20 used here
}
In the app gradle I've tried changing a lot of the dependency versions with no success. At one point that error stopped but I got another one instead.
The one thing I haven't tried yet but is next on my list is reverting to a backup pre-trying to integrate supabase, and trying updating all dependencies, one-by-one, and see what breaks and what I can get away with. Maybe having everything in a more up-to-date version could help. Haven't done it yet as the last time I tried it broke everything and I read somewhere to just leave dependencies as is, if things work.
The way I managed to resolve the issue was by upgrading everything, starting with Android Studio itself. I was in Flamingo, went to ladybug, which does not work, and downgraded to Koala.
I then changed my project gradle to
plugins {
id 'com.android.application' version '8.1.4' apply false
id 'com.android.library' version '8.1.4' apply false
id 'org.jetbrains.kotlin.android' version '2.1.0' apply false
id 'com.google.devtools.ksp' version '2.1.0-1.0.29' apply false
}
My gradle-wrapper to:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
And app gradle to:
android {
namespace 'com.molessauro.liftpath'
compileSdk 34
buildFeatures {
buildConfig true
}
defaultConfig {
applicationId "com.molessauro.liftpath"
minSdk 29
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
def properties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.newDataInputStream())
buildConfigField "String", "SUPABASE_URL", "\"${properties['SUPABASE_URL']}\""
buildConfigField "String", "SUPABASE_KEY", "\"${properties['SUPABASE_KEY']}\""
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
kotlin {
jvmToolchain(17)
}
viewBinding {
enabled = true
}
kapt {
correctErrorTypes = true
useBuildCache = true
// Enable experimental support for higher Kotlin versions
arguments {
arg("kapt.use.k2", "true")
}
}
And finally dependencies in the app gradle
// Add the BOM dependency to manage versions
implementation(platform("io.github.jan-tennert.supabase:bom:3.0.3"))
// Add the required modules
implementation("io.github.jan-tennert.supabase:supabase-kt")
implementation("io.github.jan-tennert.supabase:auth-kt") // For authentication
implementation("io.github.jan-tennert.supabase:postgrest-kt")
implementation("io.ktor:ktor-client-android:3.0.3")
This ultimately broke my MPAndroidChart-v3.1.0 so I downloaded the .aar and added it to libs/ to fix