Hi everyone, I’m not sure if this is the right cha...
# multiplatform
g
Hi everyone, I’m not sure if this is the right channel for this question — if not, my apologies. I’m having an issue navigating into the framework generated by
embedAndSignAppleFrameworkForXcode
in Xcode. Interestingly, I can navigate into it without any problems in Android Studio. The build succeeds and the app runs fine, but when I try to navigate into the imported framework in Xcode, it always shows as “unknown” / “No such module ‘…’“. This behaviour is also inconsistent — sometimes it works, sometimes it doesn’t. I have no idea what might be causing it. I’m building debug versions (both at the scheme level and
KOTLIN_FRAMEWORK_BUILD_TYPE
flag). Does anyone know how I can resolve this? From a developer experience perspective, this is making collaboration with the iOS team a bit difficult. I’ve already checked the Framework Search Paths and they seem to be correctly configured. Thanks in advance!
p
Hello @Guilherme Delgado The framework built from Kotlin module is placed to DerivedData. If Xcode can build the project that uses the framework successfully, then it should be discoverable as well. There's also a couple of things important to mention. 1. Xcode and Android Studio uses different DerivedData locations, so a project build from Android Studio won't make the framework available for Xcode, and vice-versa. 2. As the framework is located in a directory, that's already discoverable by Xcode, there is no need to add any other directories to
FRAMEWORK_SEARCH_PATHS
. Moreover, doing so might lead to duplication issues. If after building the project in Xcode, and making sure you don't have any extra search paths, the framework in
import NameOfKotlinFramework
is still unresolved in Xcode, ping me back.
f
Xcode and Android Studio uses different DerivedData locations, so a project build from Android Studio won’t make the framework available for Xcode, and vice-versa.
@Philipp Smorygo [JB] please make it possible to disable this feature; if the project doesn’t use CMP that’s a lot of useless data.
p
@François It is possible to make Kotlin Multiplatform Plugin use same DerivedData as Xcode does by setting
cidr.xcode.derived.data.override
Registry value to
false
. However this mode is not tested and there might be some unexpected errors.
👀 1
f
that’s not working, I have set this value inside the gradle.properties the CustomDerivedDataLocation is still here
p
This value should be set in IDE by opening All Actions (Cmd + Shift + A in default mac layout) and typing
Registry
there. https://youtrack.jetbrains.com/articles/SUPPORT-A-1030/How-to-edit-IntelliJ-IDE-Registry But this setting will not change where Kotlin stores it's build artifacts, if they were in
build
directory, they will remain there.
👀 1
f
Thanks I have changed the parameter successfully; but it will be better to disable this feature from the IDE settings; as you said in another thread, using the same path for Both IDE can be instable and bring conflict
anyway, I will work in this mode and see the result
g
@Philipp Smorygo [JB] Thanks for the tip. At the moment I don’t have any extra configuration in Xcode (no additional
FRAMEWORK_SEARCH_PATHS
). I’m able to build and run the project successfully both from Xcode and Android Studio. However, in both cases I still can’t navigate into the framework or get autocomplete working. The
.app
bundle does contain the framework (which makes sense, since the app runs correctly). I also noticed that this used to work at some point and then suddenly stopped. I don’t recall changing any relevant settings — I’ve only been evolving the project itself. I’ve already cleaned DerivedData on both Android Studio (Panda 2 2025.3.2 and Nightly 3.3) and Xcode (26.2.0 and 26.3.0), but the issue persists. Is there anything else I can validate or force on my side to troubleshoot this further?
I’m stuck with this kodee sad
f
it means something wring happened during the compilation of your shared library, look earlier on your build output
A tips for you: from IJ, run the task [your library]:linkDebugFrameworkIosArm64
that's the fastest way to detect compilation error before xcode
g
ok let me check, thanks for the tip 🙂
from IJ from normal build I get:
Build finished in 27 sec, 401 ms
0 warnings
will try that command above
so
linkDebugFrameworkIosArm64
gives me: BUILD SUCCESSFUL in 49s 24 actionable tasks: 13 executed, 2 from cache, 9 up-to-date
> • - [warn] Using toolchain ‘Eclipse Temurin JDK 17 (17.0.17+10)’ installed via auto-provisioning without toolchain repositories. This behavior has been deprecated. is the only warning I see from gradle
problems-report.html
f
so, you need to read the Xcode build output
It's ok on the Kotlin/Gradle side
g
But if it is ok with Kotlin (since the derived folders are differnt) shouldn’t I be able to go inside the import? I get
Cannot find declaration to go to
f
You current error is a issue about Xcode not founding your kotlin libary
classic configuration error; how did you setup your project ?
g
This project was created from a template generated by the Android Studio wizard. It had been working properly, but sometime between yesterday and the day before, it suddenly stopped working.
f
did you change your version of Xcode ?
(auto update)
g
not auto update, used xcodes to get 26.3
f
can you share you Xcode build output ? (remove personal data before 🙂 )
g
(was working on 26.2, tried again but now it fails)
can you share you Xcode build output ?
Yes one sec 😉
f
also, use PM, it's better
👍 1
g
@Philipp Smorygo [JB] I think this might be a caching issue somewhere. Both Xcode and Android Studio build with zero errors or warnings, yet I still can’t open the framework or get autocomplete in either IDE. Which locations should I check for invalid caches? I’ve already tried
gradlew clean
and various
gradle.properties
flags, but nothing has worked.
My header file is around 800 lines and growing. Could this be causing the issue? If so, how can I address it? It’s expected to export many classes…
and since i prefer controlling it via gradle I’ve created:
Copy code
tasks.register("exportFrameworkForXcode") {
    val module = "my-shared-module"
    dependsOn(":$module:embedAndSignAppleFrameworkForXcode")
    doLast {
       val targetBuildDir = System.getenv("TARGET_BUILD_DIR") ?: error("TARGET_BUILD_DIR environment variable is not set")
       val configuration = System.getenv("CONFIGURATION") ?: error("CONFIGURATION environment variable is not set")
       val sdkName = System.getenv("SDK_NAME") ?: error("SDK_NAME environment variable is not set")
       val platformName = System.getenv("PLATFORM_NAME") ?: error("PLATFORM_NAME environment variable is not set")

       val derivedDataDir = targetBuildDir.substringBefore("/Build/")
       val indexerDataDir = file("$derivedDataDir/Index.noindex/Build/Products/Debug-$platformName")
       indexerDataDir.mkdirs()

       val frameworksSourceDir = file("${rootProject.projectDir}/$module/build/xcode-frameworks/$configuration/$sdkName")
       if (frameworksSourceDir.exists()) {
          copy {
             from(frameworksSourceDir)
             into(indexerDataDir)
          }
          logger.lifecycle("Copied frameworks from $frameworksSourceDir into $indexerDataDir")
       } else {
          logger.warn("Frameworks source directory not found: $frameworksSourceDir")
       }
    }
}
works like a charm 👌
🚀 1
🎉 1
f
My header file is around 800 lines and growing. Could this be causing the issue? If so, how can I address it? It’s expected to export many classes…
Not enough to make xcode crazy
I see this kind of fix. I have done the same thing after "embedAndSignAppleFrameworkForXcode" beacuse sourceKit doesn't found the generated framework
Copy code
if [ -d "${SRCROOT}/../shared/build/xcode-frameworks/" ]; then
# There is no completion if the shared framework is not present inside a Debug folder
cd "${SRCROOT}/../shared/build/xcode-frameworks/"
# path to your shared libary
ln -Fs "${CONFIGURATION}" "Debug"
ln -Fs "${CONFIGURATION}" "Release"
fi
👍 1
g
Thank you for your time and help @François really appreciate it! 🙌🏼
Just to share more information, my build configurations were changed from Debug and Relese to DebugDev DebugPrd and ReleaseDev ReleasePrd, don't know if it is related to this. Again, it was working with this setup and then just stopped. Now it's back with that script 🎉
f
Yes, that's the reason!
xcode is dumb
it was working until you clean you builds folders
because it still looking on /Debug/ or /Release/ folder
g
🤦
f
yeah, that's really dumb