将 Android studio 更新到 3.0 后,在根项目中找不到任务“bintrayUpload”

Task ‘bintrayUpload’ not found in root project after update Android studio to 3.0

在我更新 gradle 和 android studio 之前,我曾经将我的库上传到 bintray,其中包含来自 tutorial:

的这些任务

第一个:gradlew install

秒:gradlew bintrayUpload

但是在更新 android studio 和 gradle 之后,我不得不将第一个任务更改为:gradlew installDebug 但是 gradle 找不到任务 bintrayUpload 我得到这个错误:

* What went wrong:
Task 'bintrayUpload' not found in root project 'MyProject'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

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

您需要在 build.gradle 中定义一个 bintray 任务。由于您没有,gradlew 找不到并因此无法执行该任务。根据你的设置定义类似下面的内容就可以了。

apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'


bintray {
    user = ...
    key = ....
    publications = ....
    pkg {
        ...
    }
}

解决方案在这里:我必须在 lib gradle.

中添加这些行
// Place it at the end of the file
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

然后加载 bintray 任务并将其添加到 gradle。