简体   繁体   中英

Kotlin Multiplatform error: directive doesn't match file location

I'm trying to share code between Android and iOS with Kotlin Multiplatform. The sharing part works perfectly but I have some issues to import in a common file the androidApp package. I would like to use the res folder located in androidApp in the shared class. This is my tree directory 1 :

DirectoryTree

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:

https://github.com/icerockdev/moko-resources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM