https://kotlinlang.org logo
#android
Title
# android
c

Chris Zhang

02/14/2019, 8:49 PM
Hi folks, hail mary play here — getting the following error adding a dependency on a MPP android artifact. It looks like https://github.com/Kotlin/kotlinx.coroutines/issues/510 except this is just a bare bones pet project — not using coroutines.
project-level build.gradle file:
Copy code
buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
        maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
        maven { url "<https://artifactory.global.square/artifactory/releases>" }
        maven { url "<https://artifactory.global.square/artifactory/square-public>" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
module-level build.gradle file:
Copy code
apply plugin: 'kotlin-multiplatform'
apply plugin: 'maven-publish'

kotlin {
  targets {
    final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                              ? presets.iosArm64 : presets.iosX64

    fromPreset(iOSTarget, 'ios') {
      compilations.main {
        outputKinds 'FRAMEWORK'
        extraOpts '-module-name', 'SQPEKT', '-output', "./tmp/KTPricingEngine.framework" // This should use a "real"/output path
      }
    }

    fromPreset(presets.jvm, 'android')
  }

  sourceSets {
    commonMain.dependencies {
      implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
    }

    androidMain.dependencies {
      implementation 'org.jetbrains.kotlin:kotlin-stdlib'
      implementation "com.squareup.client.protos:bills-proto:ee6541f9-7d56ab47"
    }
  }
}

// workaround for <https://youtrack.jetbrains.com/issue/KT-27170>
configurations {
  compileClasspath
}
publishing the artifact via
./gradlew publishToMavenLocal
and importing it as:
"kotlin-multiplatform-hackweek:pricingEngine-android:unspecified"
the dependency resolves but causes some R8 issue during compilation
4 Views