I am trying to set up Android Library via Kotlin Multiplatform Library.
I am getting error:
Plugin [id: 'com.android.library'] was not found in any of the following sources:
Please help me by pointing out what is wrong and how to resolve this issue.
My plugin set up is this(with supposedly proper buildscript):
plugins {
id("org.jetbrains.kotlin.plugin.serialization").version("1.3.72")
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform").version("1.3.72")
id("com.squareup.sqldelight")
}
when I replace that with following
plugins {
id("org.jetbrains.kotlin.multiplatform").version("1.3.72")
id("org.jetbrains.kotlin.plugin.serialization").version("1.3.72")
}
apply plugin: 'com.android.library'
apply plugin: 'com.squareup.sqldelight'
it's working fine. I am not sure what causes the issue.
Following is the complete build.gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
classpath 'com.android.tools.build:gradle:3.6.3'
}
}
plugins {
id("org.jetbrains.kotlin.plugin.serialization").version("1.3.72")
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform").version("1.3.72")
id("com.squareup.sqldelight")
}
repositories {
mavenCentral()
jcenter()
google()
}
group 'com.jolas.sdk.kn.newsycore'
version '0.0.1'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
def ktor_version = '1.3.2'
kotlin {
android {
publishLibraryVariants("release", "debug")
}
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
iosX64("ios") {
binaries {
framework()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-serialization:$ktor_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
}
}
iosMain {
dependencies {
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
}
}
}
}
sqldelight {
NewsyDatabase {
packageName = "com.jolas.sdk.kn.newsycore"
}
}
configurations {
compileClasspath
}