0

I'm trying to publish my own Android library to Bintray but when I uploaded from gradle successfully. I always get unexpected result from Bintray. It looks like this

enter image description here

And this is my 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']
}

What I want to have is others can download my libray just simply using

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

Can everyone support me to resolve my problem? Thank you

Uni
  • 187
  • 2
  • 7
  • 18

2 Answers2

1

I have a guide how to push Android Library to Bintray, you can try with my guide. I have already uploaded 2 libraries by this way.

Link library to bintray

Khang Tran
  • 467
  • 5
  • 16
  • Thank you very much for your great suggestion. By the way, do you know why I get failed to compile my lib uploaded previously? "Failed to resolve" com.enxinh:test-sdk:1.0.0? Thank you!! – Uni Mar 22 '18 at 08:59
  • You come from Vietnam right? :). The reason your library failed to resolve I guest because you just Upload to Bintray, you still not add it to jCenter. – Khang Tran Mar 22 '18 at 09:11
  • Yes. I'm Vietnamese. You too right? I understand the reason. I need to upgrade my account. Thank you for your best advice. By the way, cand you support me again my another problem here? https://stackoverflow.com/questions/49443806/how-to-arbitrarily-exclude-jars-from-aar-when-building-in-gradle – Uni Mar 26 '18 at 02:11
  • 1
    No need to upgrade account, I used a free account. You should create another account by the Free link: https://bintray.com/signup/oss – Khang Tran Mar 26 '18 at 05:02
  • I'm confusing why I need to create another account to link to Jcenter? I already created an account to upload my library – Uni Mar 26 '18 at 06:29
  • Because your current account is Trial Account, I guess. So you couldn't add your library to JCenter, if you like your current username you can delete the current one and create another Free Account, the trial account can't push library to JCenter, the free account can do that without pay money. – Khang Tran Mar 26 '18 at 06:40
  • Ah, I understand the problem after your explanation. I'll register new OSS account. By the way, currently I have another problem related to Android library. I raised it here. I'd be glad if you could answer: https://stackoverflow.com/questions/49443806/how-to-arbitrarily-exclude-jars-from-aar-when-building-in-gradle Just thank you very much in advance! – Uni Mar 26 '18 at 06:47
  • I successfully uploaded to Jcenter but Android Studio says that unable to resolve my package. Can you help me to check my lib? https://bintray.com/satsvmc/com.sat.svmc/CrazyImageSDK – Uni Mar 27 '18 at 03:32
  • Did you follow my guide above or another guide? – Khang Tran Apr 10 '18 at 02:49
0

Check Your POM Files dude. i have a same problem

and here's what i found in my POM files

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

you should add filesSpec in ur gradle inside bintray

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

FULL

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'
}

}

Exel Staderlin
  • 535
  • 7
  • 10