Dr.*_*yOk 43 java android gradle
我将 android studio 版本更新为 bumblebee 版本。
现在我想将导航组件添加到我的项目中。
我想将类路径添加到 gradle,但是这个文件 gradle 已更改,我不知道如何添加它。
我想将其添加       classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")到 gradle 文件中!
我的项目 gradle 文件是:
    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
}
如何将此类路径添加到应用程序 gradle ?!
Lio*_*ong 63
在2022年2月的最新版本中不再需要添加,只需添加项目的buildscriptid即可。在项目build.gradle中它将是这样的:build.gradle
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
    id 'androidx.navigation.safeargs' version '2.4.1' apply false
    // classpath are changed, so no need to add classpath anymore just the id and the version
}
不要忘记在模块中再次添加 id build.gradle,
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'androidx.navigation.safeargs'
}
Mic*_*itu 25
他们没有在发布文档中讨论,而是在插件块上方手动添加一个构建脚本块,然后在构建脚本块内添加一个依赖项块。
像这样:
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
      //......
    }
| 归档时间: | 
 | 
| 查看次数: | 31005 次 | 
| 最近记录: |