I´m complete new to Android Studio with multiplatform projects and Kotlin. Actually I´m wondering because of two things. After writing the logic in Kotlin shared/src/commonMain/... I wanted to test it by writing an Activity on the Android part. I made a new one in shared/src/AndroidMain/... by rightclick on the folder. The new Activity has been generated in shared/src/Main/... - a new folder hirachy. Why??
After that, my gradle.build in shared/ cannot be synced anymore. I´m getting the error:
Cocoapods Integration requires pod version to be specified. Please specify pod version by adding 'version = ""' to the cocoapods block. Alternatively, specify the version for the entire project explicitly. Pod version format has to conform podspec syntax requirements: https://guides.cocoapods.org/syntax/podspec.html#version
I´ve put 'version="1.0"' on every part of the gradle files where it could be right but the message still remains. Can anybody explain me excactly where to put the version number? I´ve read a lot of pages, saying all the same but nothing works for my project.
Here my shared/build.gradle.kts
plugins {
kotlin("multiplatform")
id("org.jetbrains.gradle.apple.applePlugin") version "212.4638.14-0.13.1"
//kotlin("native.cocoapods")
id ("org.jetbrains.kotlin.native.cocoapods")
id("com.android.library")
id ("com.google.gms.google-services")
kotlin("plugin.serialization")
id("org.jetbrains.kotlin.android")
}
version = "1.0"
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
version = "1.0"
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
}
specRepos {
url("https://github.com/Kotlin/kotlin-cocoapods-spec.git")
}
pod("FirebaseAuth")
}
sourceSets {
val commonMain by getting{
dependencies{
implementation("dev.gitlive:firebase-database:1.6.1")
implementation ("dev.gitlive:firebase-auth:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0-RC")
}
version = "1.0"
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
version = "1.0"
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 27
targetSdk = 32
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies{
implementation("dev.gitlive:firebase-database:1.6.1")
implementation ("dev.gitlive:firebase-auth:1.6.1")
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.appcompat:appcompat:1.5.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.3.5")
implementation("androidx.navigation:navigation-ui-ktx:2.3.5")
//implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0-RC")
}
Any help would be highly appreciated :-)
Platform Windows 11 AndroidStudio 2021.2.1 Patch 2 Kotlin 1.7.10