[英]can I use coroutine in a multi module multi language( kotlin and java ) project app?
lets say there is an android project with module a, b and c all written in java.假设有一个 android 项目,其模块 a、b 和 c 全部用 java 编写。 then I add another module, module d in the project.然后我在项目中添加另一个模块,模块 d。 can I still use coroutine internally in module d?我还能在模块 d 内部使用协程吗?
I know I cannot use it in java module, but does coroutine still work in this project even though specific module that use coroutine was pure kotlin我知道我不能在 java 模块中使用它,但是即使使用协程的特定模块是纯 kotlin,协程仍然在这个项目中工作
You can definitely use coroutines in your kotlin class without any problem.您绝对可以在 kotlin class 中毫无问题地使用协程。 The syntax remains the same as any normal kotlin project.语法与任何普通的 kotlin 项目相同。
On top of that, you can even use coroutines in your Java Class by a workaround using this.最重要的是,您甚至可以通过使用此的解决方法在 Java Class 中使用协程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.