Hi guys :slightly_smiling_face: Getting stuck here...
# multiplatform
j
Hi guys 🙂 Getting stuck here on building for Android on a multiplatform mobile library (which I was not expecting to be the issue 😛) I’ve managed to create an XCFramework for ios thanks to this https://github.com/ge-org/multiplatform-swiftpackage But now, trying to build the android part just doesn’t seem to work. The error I have is
Copy code
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
   > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/jeremy/perso/projects/untitled/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@5cf2ca8c) before task ':compileDebugJavaWithJavac' has completed is not supported
I’ll add the entire gradle file in a thread, in case anyone has the slighest idea 🙂 Thanks! 🙂
Copy code
import com.android.ide.common.repository.main

plugins {
    kotlin("multiplatform") version "1.4.32"
    id("com.android.library")
    id("org.jmailen.kotlinter") version "3.4.5"
    id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
}

group = "me.jeremy"
version = "1.0-SNAPSHOT"

repositories {
    google()
    jcenter()
    mavenCentral()
}

kotlin {
    android()
    ios {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }

    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val androidMain by getting {
            dependencies {
                implementation("com.google.android.material:material:1.3.0")
            }
        }
        val androidTest by getting {
            dependencies {
                implementation(kotlin("test-junit"))
                implementation("junit:junit:4.13.2")
            }
        }
        val iosMain by getting
        val iosTest by getting
    }
}

multiplatformSwiftPackage {
    packageName("untitled")
    swiftToolsVersion("5.3")
    targetPlatforms {
        iOS { v("13") }
    }
    outputDirectory(File(rootDir, "/testDifferentFolder"))
}

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(24)
        targetSdkVersion(30)
    }
}
l
Apply the android library plugin before the Kotlin Multiplatform one.
j
Did not help 😕 Exact same issue. Something weird is that I have a very basic unit test in commonTest, when I try to run it, there’s a few options. `iosX64`: test passes.
android (:testDebugUnitTest)
: test fails with the same error message 😕
l
I'd try to disable the kotlinter plugin
1
j
Did nothing either 😕 BUT I tried to recreate a project from scratch using the template and added plugins one by one while building at all steps... And I now have the exact same gradle files and classes (including kotlinter) but it just works 😡 Wanna bang my head against the wall...
l
Do they projects already include private code?
j
It’s literally the template project from IntelliJ when building a Mobile Library ie a couple “Greeting” classes. The only thing I added was a unit test in commonMain 😕
c
Running in to this also…
Did you manage to solve @Jérémy CROS?
RIGHT. This issue has just gone away for me when switching from Gradle 7.0.2 to 6.1.1.
👍 1