【问题标题】:Unspecified Android Library version when publishing to Bintray发布到 Bintray 时未指定 Android 库版本
【发布时间】:2018-08-26 22:12:52
【问题描述】:

我正在尝试将自己的 Android 库发布到 Bintray,但是当我从 gradle 成功上传时。我总是从 Bintray 得到意想不到的结果。看起来是这样的

这是我的 build.gradle

 apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'


// for Bintray
def projectVersionCodeNr = Integer.parseInt(projectVersionCode);
def libGit = libGit
def libUrl = libUrl
def libDescription = libDescription
def libGroupId = libGroupId
def libArtifactId = libArtifactId

android {
    compileSdkVersion 26
    buildToolsVersion "27.0.3"
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}

install {
    repositories.mavenInstaller {
        pom.project {
            name libArtifactId
            description libDescription
            url libUrl
            inceptionYear '2018'

            packaging 'aar'
            groupId libGroupId
            artifactId libArtifactId
            version '1.0.1'

            licenses {
                license {
                    name 'MIT'
                    url libLicenseUrl
                }
            }
        }
    }
}

bintray {
    user = bintray_user
    key = bintray_apikey
    pkg {
        repo = libGroupId
        name = libArtifactId
        userOrg = bintray_user_org
        licenses = ['MIT']
        vcsUrl = libGit
        version {
            name = '1.0.1'
            vcsTag = '1.0.1'
        }
    }
    configurations = ['archives']
}

我想要的是其他人只需使用即可下载我的库

compile 'com.test.sdk:mylib:1.0.1'

每个人都可以支持我解决我的问题吗?谢谢

【问题讨论】:

    标签: android android-library bintray jcenter


    【解决方案1】:

    检查您的 POM 文件,伙计。我也有同样的问题

    这是我在 POM 文件中找到的内容

      <modelVersion>4.0.0</modelVersion>
      <groupId>com.pmberjaya.library</groupId>
      <artifactId>ticketing-report-adapter</artifactId>
      <version>unspecified</version>
    

    你应该在 bintray 的 gradle 中添加 filesSpec

       filesSpec {
        from 'ticketing-report-adapter/build/outputs/aar/ticketing-report-adapter-release.aar'
        into '.'
        version '1.0'
    }
    

    已满

    bintray  {
    user = "bintray.user"
    key = "bintray.key"
    configurations = ['archives']
    pkg {
        repo = "ticketing-report-adapter"
        name = "sdk"
        version {
            name = '1.0'
            desc = 'Ticketing Upload SDK'
            released  = new Date()
            vcsTag = '1.0'
        }
        licenses = ['Apache-2.0']
    
        vcsUrl = "https://gitlab.com/exelstaderlin/ticketing-android.git"
        websiteUrl = "https://gitlab.com/exelstaderlin/ticketing-android.git"
    }
    
    filesSpec {
        from 'ticketing-report-adapter/build/outputs/aar/ticketing-report-adapter-release.aar'
        into '.'
        version '1.0'
    }
    

    }

    【讨论】:

      【解决方案2】:

      我有一个如何将 Android 库推送到 Bintray 的指南,你可以试试我的指南。我已经通过这种方式上传了2个库。

      Link library to bintray

      【讨论】:

      • 非常感谢您的建议。顺便问一下,你知道为什么我之前上传的库编译失败了吗? “无法解决”com.enxinh:test-sdk:1.0.0?谢谢!!
      • 你来自越南对吧? :)。您的库无法解析我的客人的原因是因为您只是上传到 Bintray,您仍然没有将其添加到 jCenter。
      • 是的。我是越南人。你也对吗?我明白原因。我需要升级我的帐户。谢谢你最好的建议。顺便说一句,你能再次支持我这里的另一个问题吗? stackoverflow.com/questions/49443806/…
      • 不用升级账号,我用的是免费账号。您应该通过免费链接创建另一个帐户:bintray.com/signup/oss
      • 我很困惑为什么我需要创建另一个帐户来链接到 Jcenter?我已经创建了一个帐户来上传我的图书馆
      猜你喜欢
      • 2017-08-19
      • 1970-01-01
      • 2017-01-16
      • 2017-12-27
      • 1970-01-01
      • 2015-11-18
      • 2016-03-23
      • 2017-02-19
      • 1970-01-01
      相关资源
      最近更新 更多