解决Kotlin/Native报错:There is still an unbound symbol after generation of IR module <xxx>:

2023-05-16

报错信息

There is still an unbound symbol after generation of IR module <xxx>:

Unbound public symbol IrSimpleFunctionPublicSymbolImpl: xxx

原因

其中一种情况是kn(比如iOS target)中使用compose,但是由于在其target中无法调用这个函数(或者调用这个函数没有意义),所以ir就不生成相应的函数,而是抛出异常

解决方案

这时有一种简单的方法,可以将报错信息提到的方法或类使用internal或private来修饰

这样就不会生成对应target中可以调用的函数了

或者使用另一种方式,就是直接加一个中间module,这样也可以解决这个问题

结语

不知道后续jb会不会处理这个问题?

可以参考官方github,也可以参考:ComposeViews/ios_shared at main · ltttttttttttt/ComposeViews (github.com)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解决Kotlin/Native报错:There is still an unbound symbol after generation of IR module <xxx>: 的相关文章

随机推荐