Home > OS >  How to add classpath in new version of Android Studio
How to add classpath in new version of Android Studio

Time:02-02

I updated my android studio version to bumblebee version.
Now I want add navigation component to my project.
I want add classpath to gradle, but this file gradle has been changed and I don'y know how can I add this.

I want add this classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version") to gradle files!

My project gradle file is :

    plugins {
    id 'com.android.application' version '7.1.0' apply false
    id 'com.android.library' version '7.1.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

How can I add this classpath to application gradle ?!

CodePudding user response:

They haven't talked about in the release docs but manually add a buildscript block above the plugins block then inside the buildscript block add a depedencies block.

like this:

buildscript {

        dependencies {

              classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0")

                     }
       }


plugins {
      id 'com.android.application' version '7.1.0-rc01' apply false
      //......
    }
  •  Tags:  
  • Related