java - 如何在多模块架构(Java)中使用 Safeargs?
问题描述
如何在我的应用程序的任何或所有模块中使用 Java 和 Safeargs?
我的应用程序有一个多模块设置。如果我将 Kotlin 用于模块,Safeargs 在所有模块中都可以正常工作。但是,如果我将语言切换到 Java。如果我从 app 以外的模块中删除 Safeargs 插件,错误就会消失!!我正在使用版本:1.0.0-alpha11。这是为什么??有没有办法在任何或所有模块中使用 Safeargs 和 Java?
build.gradle(项目)
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha11"
}
build.gradle (app) 没有 Safeargs
构建.gradle(用户界面)
apply plugin: 'com.android.library'
apply plugin: 'androidx.navigation.safeargs'
ERROR: null cannot be cast to non-null type org.gradle.api.resources.TextResource
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解决方案
可能是版本 1.0.0-alpha11 导致了这种情况。尝试更改为 1.0.0-beta01,这对我有用!
推荐阅读
- ruby-on-rails - Rails 5 - 在后台并发大型视频上传和 FFMPEG 编码使服务器非常慢
- intellij-idea - Intellij 播放/调试按钮消失
- php - 如何将 Blade 模板文件扩展名从 *.blade.php 更改为仅 *.blade
- maximo - 在应用程序的列表视图中突出显示记录的技术术语是什么?
- c++ - 使用 GMP 库运行 C++ 程序以使用大数导致错误:C4146: unary minus operator applied to unsigned type, result still unsigned
- python - 查找多次之间的时间差
- javascript - Enzyme wrapper.update() 导致 ref 输入不再具有 value prop
- swift - 调整 iPhone 和 iPad 中视频的帧大小
- javascript - 当空气到达右下角时,算法不能正确地杀死棋子
- swift - 删除边缘并从 PDFView 滚动