【问题标题】:Update gradle version from command line using Android command line tools使用 Android 命令行工具从命令行更新 gradle 版本
【发布时间】:2020-04-11 18:21:30
【问题描述】:

我已经安装了Android Studio的命令行工具(commandlinetools-linux-6200805_latest.zip),我想将gradle版本更新到6.2。

知道我该怎么做吗?

在 UI 中,我可以转到文件 -> 项目结构。

我需要 UI 来执行此操作吗?

尝试运行:./gradlew wrapper --gradle-version=6.2 --distribution-type=all

bash-4.2$ ./gradlew wrapper --gradle-version=6.2 --distribution-type=all

FAILURE: Build failed with an exception.

* Where:
Build file '/var/lib/jenkins/workspace/myapp/android/app/build.gradle' line: 3

* What went wrong:
An exception occurred applying plugin request [id: 'com.github.triplet.play', version: '2.7.5']
> Failed to apply plugin [class 'com.github.triplet.gradle.common.validation.RuntimeValidationPlugin']
   > Gradle Play Publisher's minimum Gradle version is at least Gradle 6.2 and yours
     is Gradle 5.6.4. Find the latest version at
     https://github.com/gradle/gradle/releases/latest, then run
     $ ./gradlew wrapper --gradle-version=$LATEST --distribution-type=ALL

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

【问题讨论】:

    标签: android-studio gradle


    【解决方案1】:

    如果您使用的是 Gradle 包装器,您可以简单地运行:

    ./gradlew wrapper --gradle-version=6.2
    

    如果您想使用不同于bin(默认)的分发类型,您可以添加distribution-type 参数:

    ./gradlew wrapper --gradle-version=6.2 --distribution-type=all
    
    

    【讨论】:

    • 运行此命令显示相同的错误(添加到问题中)
    • @TheUnreal 发生这种情况是因为该插件 (com.github.triplet.play) 在配置阶段失败。只需注释对该插件的引用,运行命令以更新我编写的包装器并再次取消注释对该插件的引用。
    猜你喜欢
    • 1970-01-01
    • 2022-01-05
    • 2021-12-02
    • 2017-07-21
    • 2020-09-20
    • 2011-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多