Hi everyone, since I use moko resource. All resour...
# moko
h
Hi everyone, since I use moko resource. All resources in sharedcommonMain:resources is not found in iOS platform. How can fix it? Thanks
like this. after config and add moko. iOS not found compose-multiplatform.xml. How can I avoid error after config moko?
AnimatedVisibility(showImage) *{*
Image(
painterResource("compose-multiplatform.xml"),
null
)
}
d
I think you got a typo, did you mean
Copy code
painterResource("action_back_white.svg")
or if
compose-multiplatform.xml
is an image try moving it to
MR/images/
directory, currently it is in
MR/
directory
h
Thanks for your feedback but I mean wanna keep use “compose-multiplatform.xml” in commonMain resources, because of after config moko. It isn’t work this case any more.
d
which config,
multiplatformResourcesClassName
?
h
After I config moko and can use resource “action_back_white.svg”. Then this code
AnimatedVisibility(showImage) *{*
Image(
painterResource("compose-multiplatform.xml"),
null
)
}
is throw error that missing resources.
d
add a copy of
compose-multiplatform.xml
to
commonMain/resources/MR/images/
and change code to
Image( painterResources(MR.images.compose-multiplatform), null )
h
In case of .gif file. I have to put it in share commonMain resources. Android can get .gif file path. but ios does. So that why I need to keep compose-multiplatform file in share commonMain resources. and do not use moko this case.
because of moko does not support load gif file yet
a
moko-resources 0.24.0 should support usage of moko-resources with compose-resources at same time. try 0.24.0-alpha-2 please
👀 1
h
@alex009 After chane moko version from 0.23.0 to 0.24.0-alpha-2. I get the error. Cannot locate tasks that match
':shared:resources:copyFrameworkResourcesToApp' as task 'copyFrameworkResourcesToApp' not found in project ':shared:resources'.
moko 0.23.0 work fine. My structure module resources: • shared. ◦ resources
make sure that module shared and shared:resources is static framework
Copy code
# Type a script or drag a script file from your workspace to insert its path.
   "$SRCROOT/../gradlew" -p "$SRCROOT/../" :shared:resources:copyFrameworkResourcesToApp \
    -Pmoko.resources.BUILT_PRODUCTS_DIR="$BUILT_PRODUCTS_DIR" \
    -Pmoko.resources.CONTENTS_FOLDER_PATH="$CONTENTS_FOLDER_PATH" \
    -Pkotlin.native.cocoapods.platform="$PLATFORM_NAME" \
    -Pkotlin.native.cocoapods.archs="$ARCHS" \
    -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
here is my script.0.23.0 work fine.
Here is my sample with 0.24.0-alpha-2. please help to take a look.
y
Hi, I can’t check on moko-resources 0.23.0 due to gradle issues, tested on 0.24.0-alpha-2 and can’t find “copyFrameworkResourcesToApp” task. Note: we use static framework and we tried all solutions my modules structure • kmpfeaturesroot (applied moko-plugin and added ios exports) • kmplibrariesresources (applied moko-plugin + setup resources from documentation) all modules are “static” without any changes in folder structure. if try to list all available gradle commands, there is no necessary “copy*” command at all
🙌 1
a
h
@alex009 now just base on my sample and 0.24.0-alpha-2 might not create task copyFrameworkResourcesToApp. If I rollback to version 0.23.0. my sample can work https://kotlinlang.slack.com/archives/CMC5LN42W/p1706001275518289?thread_ts=1705913203.842639&cid=CMC5LN42W
a
thx. we will fix in new alpha
🙌 1
i save sample here
1
h
Many thanks @alex009
Hi @alex009 I’ve tried to use version
0.24.0-alpha-4
but it’s not working in my case. Compose resource might replaced by moko resource in ios/ Please use this sample. https://kotlinlang.slack.com/archives/CMC5LN42W/p1706001275518289?thread_ts=1705913203.842639&cid=CMC5LN42W got error.
Copy code
Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: compose-multiplatform.xml
k
Hi, i'm sorry but on current time we can't help u with compose-resources with moko-resources in project, because: us plugin in incompatiblePlugins list in compose-multiplatform: https://github.com/JetBrains/compose-multiplatform/blob/ad9c89865153a904bdd35f2c69[…]rg/jetbrains/compose/resources/ios/configureSyncIosResources.kt I think we should find connect with JetBrains and discuss about this.
h
@Konstantin Kolchurin Thanks for clarifying
215 Views