无法使用Bintray在jCenter上发布Android Studio库

时间:2016-10-11 10:27:12

标签: android-studio bintray jcenter

我按照本教程在Jcenter上发布了一个示例Android Studio库:

http://crushingcode.co/publish-your-android-library-via-jcenter/

看来很清楚。 我已经通过以下链接创建了我的GitHub存储库:

https://github.com/alessandroargentieri/mylibview

我也已登录Bintray.com,并创建了一个新的存储库,必须包含我的库(如上面的教程中所述)。

要在Bintray上发布存储库,我必须创建一个组织,然后创建存储库。所以这些是我的数据:

Bintray用户名: alessandroargentieri
组织: alexmawashi
存储库: https://bintray.com/alexmawashi/my_android_repository

然后,在Android Studio中,在我的库模块的gradle文件中,我有这些数据:

apply plugin: 'com.android.library'

ext {
    bintrayRepo = 'my_android_repository'       //maven
    bintrayName = 'mylibview'   // Has to be same as your library module name

    publishedGroupId = 'mawashi.alex.mylittlelibrary'
    libraryName = 'MyLibView'
    artifact = 'mylibview'     // Has to be same as your library module name

    libraryDescription = 'Android Library to use a custom view'

    // Your github repo link
    siteUrl = 'https://github.com/alessandroargentieri/mylibview'
    gitUrl = 'https://github.com/alessandroargentieri/mylibview.git'
    githubRepository= 'alessandroargentieri/mylibview'

    libraryVersion = '1.0'

    developerId = 'alexmawashi'
    developerName = 'Alessandro Argentieri'
    developerEmail = 'alexmawashi87@gmail.com'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}
...
...
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle'

当我使用终端并写: 的 gradlew clean build install bintrayUpload --stacktrace

几分钟后,我收到了这个错误:

 What went wrong:
Execution failed for task ':mylittlelibrary:bintrayUpload'.
> Could not create package 'alessandroargentieri/my_android_repository/mylibview': HTTP/1.1 404 Not Found [message:Repo 'my_android_repository' was not found]

我做错了什么? 感谢。

2 个答案:

答案 0 :(得分:4)

答案 1 :(得分:3)

为了使其正常工作,您的gradle.properties文件需要配置bintray.user和bintray.apikey(这是您的bintray API密钥)(请参阅https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle中的包含)