Reza
Reza

Reputation: 31

How can I add the Safe Args library to my project?

I want to add the Safe Args library to my project using Java. I add these in Android Studio, and it downloads and adds them automatically.

  def nav_version = "2.7.5"
  // Java language implementation
  implementation "androidx.navigation:navigation-fragment:$nav_version"
  implementation "androidx.navigation:navigation-ui:$nav_version"

But when I try to add these to my project

buildscript {
    repositories {
        google()
    }
    dependencies {
        def nav_version = "2.7.5"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    }
}

Android Studio doesn't reach the download stage and encounters an error


No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.7.5 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:

I've been dealing with this issue for a while. Thank you in advance.

I handed the project to someone else for testing, and it worked correctly for them. I don't know why I'm encountering this issue.

Upvotes: 2

Views: 473

Answers (0)

Related Questions