Java/RXJava3 从其他来源构建时出错
Java/RXJava3 error when building from another source
C:\Users\Admin\Desktop\ExternalPlugins-master\PerfectSpec\src\main\java\net\runelite\client\plugins\perfectspec\MenuEntrySwapConsumer.java:47: error: cannot access Consumer
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
^
class file for io.reactivex.rxjava3.functions.Consumer not found
我对 Java 有点陌生,我正在尝试使用来自其他来源的代码构建我的程序,但我收到了这个错误。我正在使用 Intellij,有人知道如何修复它吗?
谢谢!
此项目构建文件具有无效的依赖项。它导入 rxjava2
库,同时在代码中使用 rxjava3
。
要解决此问题,您需要编辑 Dependencies.kt:46
并将其更改为 const val rxjava = "io.reactivex.rxjava3:rxjava:${Versions.rxjava}"
。
然后在 Dependencies.kt:38
处更改为 const val rxjava = "3.0.1"
。
然后注释这些行:
build.gradle.kts:15
(implementation("io.reactivex.rxjava3:rxjava:3.0.1")
)
PerfectSpec/perfectspec.gradle.kts:38
(compileOnly("io.reactivex.rxjava2:rxjava:2.2.19")
)
net/runelite/client/plugins/externals/perfectspec/MenuEntrySwapConsumer.java:48
处也有一个错字,这一行大概应该是这样的:eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
.
在这些更改之后,项目导入和构建对我来说没有错误。
C:\Users\Admin\Desktop\ExternalPlugins-master\PerfectSpec\src\main\java\net\runelite\client\plugins\perfectspec\MenuEntrySwapConsumer.java:47: error: cannot access Consumer
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
^
class file for io.reactivex.rxjava3.functions.Consumer not found
我对 Java 有点陌生,我正在尝试使用来自其他来源的代码构建我的程序,但我收到了这个错误。我正在使用 Intellij,有人知道如何修复它吗?
谢谢!
此项目构建文件具有无效的依赖项。它导入 rxjava2
库,同时在代码中使用 rxjava3
。
要解决此问题,您需要编辑 Dependencies.kt:46
并将其更改为 const val rxjava = "io.reactivex.rxjava3:rxjava:${Versions.rxjava}"
。
然后在 Dependencies.kt:38
处更改为 const val rxjava = "3.0.1"
。
然后注释这些行:
build.gradle.kts:15
(implementation("io.reactivex.rxjava3:rxjava:3.0.1")
)PerfectSpec/perfectspec.gradle.kts:38
(compileOnly("io.reactivex.rxjava2:rxjava:2.2.19")
)
net/runelite/client/plugins/externals/perfectspec/MenuEntrySwapConsumer.java:48
处也有一个错字,这一行大概应该是这样的:eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
.
在这些更改之后,项目导入和构建对我来说没有错误。