在任务配置中发现了一些问题:app:bintrayUpload'尝试将Android库上传到jCenter时

时间:2015-08-02 16:26:48

标签: android maven gradle android-gradle jcenter

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

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

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

:app:bintrayUpload FAILED

失败:构建因异常而失败。

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

    没有为属性" packageName'指定任何值。   没有为属性'用户'指定值。   没有为物业指定价值' apiKey'。   没有为属性" repoName'指定值。

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

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

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

失败:构建因异常而失败。

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

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

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

我是否需要将JDK和JRE路径声明为Windows Envirorment变量?

这是我的顶级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"]
}

有人可以帮我解决这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

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

您的ConfigureAwait项目文件应该是这样的。

build.gradle

并在您想要上传到jcenter的所需模块的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' } } //... } 文件的末尾添加这些行

build.gradle

并将您的apiKey和bintray用户名添加到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' 并将您的gradle版本更改为local.properties

然后执行

2.2.1

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

gradlew.bat install

还要确保已设置JDK路径。