尝试将 Android 库上传到 jCenter 时发现任务“:app:bintrayUpload”的配置存在一些问题

Some problems were found with the configuration of task ':app:bintrayUpload' when trying to upload an Android Library to jCenter

我正在尝试将我的库上传到 jCenter。我正在学习本教程:

http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

按照步骤操作并在 Android 终端中输入“> gradlew bintrayUpload”后,我收到以下错误:

:app:bintrayUpload 失败

失败:构建失败,出现异常。

在将我的问题标记为重复之前,我将指出我尝试了以下 Whosebug 问题的解决方案:

尝试该解决方案后,出现以下错误:

失败:构建失败,出现异常。

搜索这个错误,我从 Whosebug 上的这个问题得到了以下解决方案:

这不是我的解决方案。我的 jdk/jre 路径存在。我曾多次尝试在它们之间切换。选答题:

我是否需要将 JDK 和 JRE 路径都声明到 Windows 环境变量中?

这是我的最高水平build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:1.2.3'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'

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

allprojects {

//apply plugin: 'com.jfrog.bintray'

repositories {
    jcenter()
    }
}

这是我的 build.gradle(应用程序模块):

apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"

defaultConfig {
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {

    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
}

ext {
    bintrayRepo = 'maven'
    bintrayName = 'Library Name'

publishedGroupId = '...'
libraryName = '...'
artifact = '...'

libraryDescription = 'A simple library for setting a single font in a View in Android.'

siteUrl = '...'
gitUrl = '...'

libraryVersion = '1.0'

developerId = '...'
developerName = '...'
developerEmail = '...'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

谁能帮我解决这个问题?

谢谢!

这里有一个将库上传到 bintray 的简单教程。

你的 build.gradle 项目文件应该是这样的。

buildscript {
 //...
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        }
}
    //...    
}

并在您要上传到 jcenter 的所需模块的 build.gradle 文件末尾添加这些行

ext {
    developerId = 'your username in bintray'
    developerName = 'your name'
    developerEmail = 'your email'
    bintrayRepo = 'maven'
    bintrayName = 'your library name in bintray'

    publishedGroupId = 'your group id'
    libraryName = 'your library name(better to be as like as bintrayName)'

    artifact = 'your artifact'

    libraryDescription = 'description'
    libraryVersion = 'version'

}
apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/install.gradle'
apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/bintray.gradle'

并将你的 apiKey 和用户名添加到你的 local.properties 并将你的 gradle 版本更改为 2.2.1

然后执行

gradlew.bat install

如果显示成功消息,则通过此命令将您的项目上传到 bintray

gradlew.bat bintrayUpload

还要确保设置了 JDK 路径。