[英]Kotlin Multiplatform error: directive doesn't match file location
I'm trying to share code between Android and iOS with Kotlin Multiplatform.我正在尝试使用 Kotlin Multiplatform 在 Android 和 iOS 之间共享代码。 The sharing part works perfectly but I have some issues to import in a common file the androidApp package.
共享部分工作正常,但我有一些问题要在通用文件中导入 androidApp 包。 I would like to use the res folder located in androidApp in the shared class.
我想在共享类中使用位于 androidApp 中的 res 文件夹。 This is my tree directory 1 :
这是我的树目录1 :
Thanks!谢谢!
Usually you don't have to import specific platform package to the shared part.通常您不必将特定平台包导入共享部分。
The direction is quite the opposite.方向正好相反。
Use the shared part in the native ones.使用本机中的共享部分。
If you need to share resources in an Android manner I suggest you to have a look here:如果您需要以 Android 方式共享资源,我建议您查看这里:
https://github.com/icerockdev/moko-resources https://github.com/icerockdev/moko-resources
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.