【问题标题】:Some problems were found with the configuration of task ':app:bintrayUpload' when trying to upload an Android Library to jCenter尝试将 Android 库上传到 jCenter 时,发现任务 ':app:bintrayUpload' 的配置存在一些问题
【发布时间】:2015-10-24 18:36:02
【问题描述】:

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

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

按照这些步骤并开始在 Android 终端中输入 "> gradlew bintrayUpload" 我收到以下错误:

:app:bintray上传失败

FAILURE:构建失败并出现异常。

  • 出了什么问题: 发现任务 ':app:bintrayUpload' 的配置存在一些问题。

    没有为属性“packageName”指定值。 没有为属性“用户”指定值。 没有为属性“apiKey”指定值。 没有为属性“repoName”指定值。

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

Publications(s) specified but no publications exist in project :library

尝试该解决方案后,我收到以下错误:

FAILURE:构建失败并出现异常。

  • 出了什么问题:
    在根项目“UniFont”中找不到任务“bintrayUpload”。

搜索这个错误,我从stackoverflow上的这个问题得到以下解决方案: Task 'bintrayUpload' not found in root project 'bin'

这不是我的解决方案。我的 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(app 模块):

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"]
}

谁能帮我解决这个问题?

谢谢!

【问题讨论】:

  • 你在local.properties声明你的apiKey了吗?
  • 是的。我已经声明了我的 apiKey。
  • github.com/danielemaddaluno/gradle-jcenter-publish 我现在用这个。它说“无法解析符号:pom”。我在另一个教程中遇到了这个问题。你有同样的问题吗?
  • 谢谢!但我仍然有同样的问题:“无法解析符号:pom”。你可以上传你的 build.gradle 文件和你使用的 gradle 版本吗?这对我有很大帮助。
  • 好的,我添加了。希望对您有所帮助;)

标签: android maven gradle android-gradle-plugin jcenter


【解决方案1】:

这是一个将库上传到 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 和 bintray 的用户名添加到您的 local.properties 并将您的 gradle 版本更改为 2.2.1

然后执行

gradlew.bat install

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

gradlew.bat bintrayUpload

还要确保设置了 JDK 路径。

【讨论】:

  • 这并不是真正的解决方案。我不知道怎么做,但我做到了。但无论如何,我同意你并投票支持你的兴趣和帮助。
  • 下面一行的作用是什么?我们可以跳过这行吗?申请自:'raw.githubusercontent.com/smasoumi/Bintray/master/…'
  • @VladIancu 你不应该免费投票。答案没有帮助。不应该被接受。它使其他人感到困惑。
猜你喜欢
  • 2021-08-29
  • 2013-11-04
  • 2017-02-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多