kfiross / flutter_mongodb_realm

Unofficial Flutter plugin for using MongoDB Realm services on Android, iOS and web.
Apache License 2.0
41 stars 17 forks source link

Android Kotlin version is breaking new Flutter app #51

Open jpeiffer opened 11 months ago

jpeiffer commented 11 months ago

On a new Flutter app created via flutter create using version 3.13.9, bringing this package in causes Android to fail to compile with the error:

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_mongodb_realm' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
jpeiffer commented 11 months ago

It looks like changing the android/build.gradle from:

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath "io.realm:realm-gradle-plugin:10.2.0"
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
    }
}

... to this...

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath "io.realm:realm-gradle-plugin:10.2.0"
   }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
    }
}

... resolves the problem

kfiross commented 11 months ago

@jpeiffer Thanks! i will update the package soon