Does anyone know why I would be having issues impo...
# multiplatform
w
Does anyone know why I would be having issues importing the
import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
task into my
build.gradle
file? I am trying to create a fat framework that can be consumed in my iOS sample application.
k
that's just the IDE. ignore it.
e
It’s not just the IDE. Its probably because of how Gradle resolves dependencies for Kotlin scripts. Have you tried the
pluginManagement
block instead of the
buildscript
block for defining the plugin dependencies
k
i had the same issue with the same import in Groovy DSL (doesn't affect Kotlin DSL). in my case it was an IDE issue and the project built fine.
e
Yeah just noticed OP is also using Groovy so youre probably correct.
w
Thanks for the replies! I am still having issues creating the framework and having it be consumed correctly in my iOSApp
k
what's the error and at what step are you experiencing it?
w
My team is trying to chain library projects together.
custom_project_kotlin_common
->
custom_project_kotlin_ux
(this outputs fat framework) -> iOS framework project
custom_project_ux_ios
(this outputs fat framework to be consumed by iOS Application) ->
custom_app_ios
sample application.
the fat framework task would live in the build.gradle of the
custom_project_kotlin_common
and
custom_project_kotlin_ux
kotlin project
I am also having an error in my build.gradle file in the copyFramework task:
Could not get unknown property 'ios' for KotlinTarget container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.
Here is the code in my build.gradle:
Copy code
targets {
        iosX64("iosX64")
        iosArm64("ios64")
        configure([iosX64, ios64]) {
            binaries.framework {
                baseName = "my_framework"
            }
        }
    }
    // Create a task building a fat framework.
    task debugFatFramework(type: FatFrameworkTask) {
        // The fat framework must have the same base name as the initial frameworks.
        baseName = "my_framework"
        // The default destination directory is '<build directory>/fat-framework'.
        destinationDir = file("$buildDir/fat-framework/debug")
        // Specify the frameworks to be merged.
        from(
                targets.iosX64.binaries.getFramework("DEBUG"),
                targets.ios64.binaries.getFramework("DEBUG")
        )
    }
i
I am also having an error in my build.gradle file in the copyFramework task:
Could not get unknown property 'ios' for KotlinTarget container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.
Your snippet doesn't contain the
copyFramework
task. Could you please provide a part of the the buildscript that contains this task?
the fat framework task would live in the build.gradle of the
custom_project_kotlin_common
and
custom_project_kotlin_ux
kotlin project
Is it correct that you try to create two fat frameworks: one from
custom_project_kotlin_common
and another from
custom_project_kotlin_ux
, and then attach both of them to the same iOS app?