I would like to use org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.41 instead of org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.41
Is there a way to exclude org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.41 from the Realm Android Kotlin Extensions Plugin?
Hi @phileo
Sorry for the late reply. We use a gradle plugin because it makes it easier to setup a larger number of dependencies, but it also unfortunately also makes it a bit harder to customize.
In your case you can stop using the Realm Gradle plugin and instead setup everything manually. Like so:
Current approach:
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:5.2.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
New approach:
buildscript {
ext.kotlin_version = '1.2.41'
ext.realm_version = '5.2.0'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "io.realm:realm-transformer:$realm_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
import io.realm.transformer.RealmTransformer
android.registerTransform(new RealmTransformer(project))
dependencies {
api "io.realm:realm-annotations:${realm_version}"
api("io.realm:realm-android-kotlin-extensions:${realm_version}") {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
}
api "io.realm:realm-android-library:${realm_version}"
kapt "io.realm:realm-annotations-processor::${realm_version}"
}
If you are using synchronized Realms realm-android-kotlin-extensions and realm-android-library needs to be suffixed with -object-server so they become: realm-android-kotlin-extensions-object-server and realm-android-library-object-server.
The above was added to the website docs, so we can easily refer to it in the future. Closing.
Most helpful comment
Hi @phileo
Sorry for the late reply. We use a gradle plugin because it makes it easier to setup a larger number of dependencies, but it also unfortunately also makes it a bit harder to customize.
In your case you can stop using the Realm Gradle plugin and instead setup everything manually. Like so:
Current approach:
New approach:
If you are using synchronized Realms
realm-android-kotlin-extensionsandrealm-android-libraryneeds to be suffixed with-object-serverso they become:realm-android-kotlin-extensions-object-serverandrealm-android-library-object-server.