I’m getting the following gradle error output whil...
# multiplatform
s
I’m getting the following gradle error output while compiling. I can’t figure out how to solve the error. Can someone help me figure out how to solve this?
Copy code
REPO_ROOT="$PODS_TARGET_SRCROOT"
                "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework                     -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME                     -Pkotlin.native.cocoapods.archs="$ARCHS"                     -Pkotlin.native.cocoapods.configuration=$CONFIGURATION                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :buildSrc:compileKotlin UP-TO-DATE
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources NO-SOURCE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:inspectClassesForKotlinIC UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:compileTestKotlin NO-SOURCE
> Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:validatePlugins UP-TO-DATE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE

> Configure project :coroutine-cache
Warning: Kotlin language settings function 'useExperimentalAnnotation' is deprecated and will be removed in next major releases. Please, use 'optIn' instead.


> Configure project :presentation
Unable to detect Kotlin framework build type for CONFIGURATION=QA Debug automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=QA Debug automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=QA Debug automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=QA Debug automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'

FAILURE: Build failed with an exception.

* What went wrong:
Task 'Debug' not found in project ':presentation'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See <https://docs.gradle.org/7.3.2/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD FAILED in 9s
6 actionable tasks: 6 up-to-date
m
Seems like you are using custom build type. You need to provide a mapping for those in cocoapods block. See step 4 xcodeConfigurationToNativeBuildType at https://kotlinlang.org/docs/native-cocoapods.html#install-the-cocoapods-dependency-manager-and-plugin
s
I already have
xcodeConfigurationToNativeBuildType[*"QA"*] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType[*"QA Debug"*] = NativeBuildType.DEBUG
m
Try setting KOTLIN_FRAMEWORK_BUILD_TYPE to “debug” in your ios target build settings
s
I found that bug earlier and tried that in xcode. It didn’t work for me. I was able to get the warning to go away by setting the environment variable via reflection. The same error of
Task 'Debug' not found in project ':presentation'
still persists though.
Copy code
fun updateEnv(name: String, value: String) {
    val env: Map<String, String> = System.getenv()
    val field: java.lang.reflect.Field = env.javaClass.getDeclaredField("m")
    field.isAccessible = true
    val map = field.get(env) as MutableMap<String, String>
    map[name] = value
}

updateEnv("KOTLIN_FRAMEWORK_BUILD_TYPE", "debug")
A link to my gradle file is in the ticket I filed for this - https://youtrack.jetbrains.com/issue/KT-50375
m
gradle file looks fine to me. Can you share a minimal reproducible project? It would be easier to identify the issue with it.
Also try running gradle with --stacktrace option, that may give some insights