【问题标题】:How to run gradle commands in Android Studio terminal?如何在 Android Studio 终端中运行 gradle 命令?
【发布时间】:2020-06-23 05:35:10
【问题描述】:

我的项目中存在依赖冲突。所以,我想先看看依赖树。但是命令不起作用。我正在使用windows 操作系统。我需要更改任何设置选项吗?或者使用任何插件来观察依赖冲突?

buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath 'com.google.gms:google-services:4.3.3'
        def nav_version = "2.3.0-beta01"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

【问题讨论】:

    标签: android kotlin gradle terminal build.gradle


    【解决方案1】:

    如果你是 windows 用户,那么在终端类型中 gradlew 任务名称 如果你是 mac 用户类型 ./gradlew 任务名称

    任务名称可能是您的要求,例如如果您想调试,那么任务名称将是 assembleDebug 或者如果您需要将 apk 安装到模拟器上,它会是 installDebug

    【讨论】:

    • gradlew app:dependencies --scan 命令呢?它不工作。 shell 的可执行路径有什么需要改变的吗?
    • 您可以添加依赖项然后同步项目。我不确定我们是否可以使用终端 link 更改依赖项检查这个我经历了这个但我无法获得终端命令更改依赖项对不起
    • 我已经通过清除IDE的所有缓存解决了。起初我尝试运行invalidate caches and restart。但这并没有解决。谢谢
    猜你喜欢
    • 2019-02-13
    • 1970-01-01
    • 2020-04-10
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 2021-10-24
    • 1970-01-01
    相关资源
    最近更新 更多