Nathan Tamez
08/16/2023, 5:16 PMColton Idle
08/16/2023, 8:26 PMNathan Tamez
08/16/2023, 9:03 PMbuild.gradle.kts
, that we share across ios. js and android
kts
sourceSets.all {
languageSettings.apply {
languageVersion = "1.7"
apiVersion = "1.7"
}
}
sourceSets {
// commonMain
// commonTest
// etc
val jsMain by getting {
languageSettings.apply {
languageVersion = "1.9"
apiVersion = "1.9"
}
}
val jsTest by getting {
languageSettings.apply {
languageVersion = "1.9"
apiVersion = "1.9"
}
dependencies {
implementation(kotlin("test-js"))
}
}
}
and this in our build.gradle.kts
for android
kts
android {
namespace = "some.namespace"
compileSdk = 31
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("<http://consumer-rules.pro|consumer-rules.pro>")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"<http://proguard-rules.pro|proguard-rules.pro>"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
jvmToolchain(11)
}
kotlinOptions {
jvmTarget = "11"
languageVersion= "1.7"
apiVersion = "1.7"
}
}
but when we try to consume the sdk in an completely separate android sample app we get this error, (our internal test app builds fine as it uses the same 1.9 build chain)
/user/someuser/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.9.0/kotlin-stdlib-common-1.9.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
but if we add this to the android app build.gradle.kts
It builds and runs fine, but asking customers to add this to their app is not ideal, is there a way to fix this in the sdk? or is there a better way to do this?
kts
allprojects {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xskip-metadata-version-check"
]
}
}
}
Colton Idle
08/17/2023, 3:32 AM