Can't integrate realm into android library module with kotlin

To fix the issue: top build.gradle file:

buildscript {
    ext.kotlin_version = '1.3.31'
    repositories {
        mavenLocal()
        google()
        jcenter()

        //region realm
        maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
        maven { url 'https://dl.bintray.com/realm/maven' }
        //endregion
    }
    dependencies {
        //region google()
        classpath 'com.android.tools.build:gradle:3.3.2'
        //endregion
        //region jcenter()
        classpath 'com.google.gms:google-services:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        //endregion

        //region realm
        classpath "io.realm:realm-gradle-plugin:5.11.0"
        //endregion
    }
}

allprojects {
   ...

    configurations.all {
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jre7'

        resolutionStrategy {
            // fail eagerly on version conflict (includes transitive dependencies)
            // e.g. multiple different versions of the same dependency (group and name are equal)
            failOnVersionConflict()

            //this is needed:
            force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
                    "org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version",
                    "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",

        }
    }
}