0

I am new to Android Studio and I am trying to use the latest navigation version which I believe is 2.3.0. However, after adding it to the dependencies in the gradle file I still seem to get an error that it could not find the classpath. Any tips? Here are some screenshots:

The dependencies and the navigation The error message

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Try this instead `classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"` – notquiteamonad Jul 02 '20 at 20:41
  • Ah ok, that builds. The classpath I had there was from one of the tutorials in Kotlin. However, it says that I should have access to a GameFragmentDirections class in the java generated folder, but it's not recognised. – Shrimat Kapoor Jul 02 '20 at 20:46
  • What version of Studio are you using? Studio 4.1 Beta 1 and 4.2 Canary 2 had an issueswith Directions classes not being recognized by Studio. – ianhanniballake Jul 02 '20 at 20:48
  • Android Studio 4.0 Build #AI-193.6911.18.40.6514223, built on May 20, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64 I think this, 4.0 I am assuming? – Shrimat Kapoor Jul 02 '20 at 20:51
  • Thanks, everyone for the help! For anyone having problems with getting a directions class, this solved my problem: https://stackoverflow.com/questions/50686907/safeargs-library-doesnt-generate-direction-class – Shrimat Kapoor Jul 02 '20 at 21:13

1 Answers1

0

You are using:

classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$nav_version"

It was the 1st release and the latest version is 1.0.0

With androidx migration you have to use:

def nav_version = "2.3.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

More info in the official doc.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841