Linked Questions

Popular Questions

How to use Safeargs in multi-module architecture (Java)?

Asked by At

How can I use Java and Safeargs in any or all modules of my app??

I have a multi-module setup for my app. If I use Kotlin for the modules Safeargs works fine in all modules. But if I switch the language to Java. If I remove Safeargs plugin from modules other than app the error disappears!! I am using version: 1.0.0-alpha11. Why is that?? Is there any way to use Safeargs and Java in any or all modules??

build.gradle (project)

dependencies {
        classpath ''
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha11"

build.gradle (app) does not have Safeargs

build.gradle (ui)

apply plugin: ''
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.

Related Questions