You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After migrating from a dynamic framework, that used CocoaPods plugin, to a static one, without the latter, we faced difficulties with bundling resources to the app.
Setup
As shown in the ReadMe file, we added the following script to our build phase:
Resources plugin is added to the submodule and to the shared module.
Resources library is added to the submodule and the shared module through implementation(...).
Here's how we build and link the shared framework to the iosApp (This script runs before copying resources, as shown above):
if [ "YES"="$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ];thenecho"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""exit 0
ficd"$SRCROOT/../../"
./gradlew :app:composeApp:embedAndSignAppleFrameworkForXcode
Diagnosis
Running find . -type d -name "*.bundle" in the build folder of the shared module shows that bundles exist during the build phase:
Running ./gradlew tasks in the root project folder shows that copy tasks are correctly generated:
**Moko-resources tasks****--------------------**
copyResourcesDebugFrameworkIosArm64
copyResourcesDebugFrameworkIosSimulatorArm64
copyResourcesDebugFrameworkIosX64
copyResourcesDebugTestIosArm64
copyResourcesDebugTestIosSimulatorArm64
copyResourcesDebugTestIosX64
copyResourcesReleaseFrameworkIosArm64
copyResourcesReleaseFrameworkIosSimulatorArm64
copyResourcesReleaseFrameworkIosX64
generateMR
....
// остальные все generate
Workaround
During our discussion with the author @Alex009, we realized that the issue is caused by custom build CONFIGURATION name. In our case, we used DebugDevelopment, while the copy tasks expected something like Debug or Release for static frameworks.
As a workaround, we added KOTLIN_FRAMEWORK_BUILD_TYPE variable to configuration files, with the following values:
Problem
After migrating from a dynamic framework, that used CocoaPods plugin, to a static one, without the latter, we faced difficulties with bundling resources to the app.
Setup
As shown in the ReadMe file, we added the following script to our build phase:
Everything else is set up correctly:
implementation(...)
.Here's how we build and link the shared framework to the iosApp (This script runs before copying resources, as shown above):
Diagnosis
find . -type d -name "*.bundle"
in the build folder of the shared module shows that bundles exist during the build phase:./gradlew tasks
in the root project folder shows that copy tasks are correctly generated:Workaround
During our discussion with the author @Alex009, we realized that the issue is caused by custom build
CONFIGURATION
name. In our case, we usedDebugDevelopment
, while the copy tasks expected something likeDebug
orRelease
for static frameworks.As a workaround, we added
KOTLIN_FRAMEWORK_BUILD_TYPE
variable to configuration files, with the following values:Then we updated the copy script to use
KOTLIN_FRAMEWORK_BUILD_TYPE
instead ofCONFIGURATION
, which now looks like this:This solved our problem! 🎉
The text was updated successfully, but these errors were encountered: