Android studio 2.2.2 uses the binary repository to publish my app module to jcenter as a library

Here, I have successfully completed the QR code scanning project. I use the qrcodereader view 1.0.0 V URL repository. This is my dependency

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
    compile files('libs/ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar')
}

There is only one app module in my project. I want to upload this project as a library (. AAR) to the jcenter repository

I've tried some jcenter upload steps, and I've got a successful upload response from bintrayupload

For this reason, I created GitHub login and created the project URL. However, I did not upload my project code to GitHub. I only gave an empty project URL in build.gradle

However, when I see it in the binary repository, there are no code updates / version changes on my binary Maven repository

Android studio project is converted to an. AAR (Library) file and uploaded to the jcenter repository in the following steps

1) . I have changed the main application module build.gradle file to make three changes. I have changed the library plug-in, annotated the application ID, and changed the manifest file launcher activity

My app module build.gradle file:

//apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
ext {
    bintrayRepo = 'maven' //mavenrepo
    bintrayName = 'app'

    publishedGroupId = 'com.test.testsdkproj16'
    libraryName = 'TestsdkProj16'
    artifact = 'app'

    libraryDescription = 'A simple qr code library calling your project in Android'

    siteUrl = 'https://github.com/vhkrishnanv/TestsdkProj16'
    gitUrl = 'https://github.com/vhkrishnanv/TestsdkProj16.git'
    githubRepository= 'vhkrishnanv/TestsdkProj16'

    libraryVersion = '1.0.0'

    developerId = 'vhk*********6'
    developerName = 'harikrish'
    developerEmail = 'vhkris******@gmail.com'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}
allprojects {
    repositories {
        jcenter()
    }
}
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        //applicationId "com.test.testsdkproj16"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
    compile files('libs/ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar')
}

// Place it at the end of the file
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

My manifest file:

 <activity android:name=".MainActivitySDK_16">
            <intent-filter>
                <action android:name="com.test.testsdkproj16.MainActivitySDK_16" />
                <!--comment when exporting AAR below two lines-->
                 <!--<action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />-->
            </intent-filter>
        </activity>

Gradle.properties file:

bintray.user=vhk*********6
bintray.apikey=***1f************************98f51***

2) . next steps to upload my studio project to bindray.com. I have used three commands

-gradleW clean
BUILD SUCCESSFUL
-gradleW install
BUILD SUCCESSFUL
-gradleW bintrayupload
BUILD SUCCESSFUL

After executing the above three commands, when I see it in my binary repository, there is no change in my repository

Screenshot of my repository

I don't know exactly which step is missing. Anyone can help solve this mistake

In general, I want to publish my studio 2.2.2 project (converted to. AAR Library) to the jcenter repository and need to get my project URL. (when I try this URL in other new projects in the dependency, I get an error during synchronization because the code /. AAR is not uploaded in the repository)

I have a final step to be determined. Once the code is uploaded, I need to wait for jcenter synchronization in the binary repos. Then, I can use the above URL for other new projects

compile 'com.test.testsdkproj16:app:1.0.0' 

resolvent:

In your question, you have saved the letter of credit in the bindray account in gradle.properties:

bintray.user=vhk*********6
bintray.apikey=***1f************************98f51***

If you view the source file from:

https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle

You will see the following line:

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

You have placed the letters of credit in the wrong file. They should be in local.properties

After a long discussion, the editor finally released the project to bindray. The question here is that the user is publishing to another organization project. In fact, the answer of @ GBA is correct. However, it is recommended that @ harikrishnan download bindray.gradle and install.gradle into the project and modify them. The following is what they should think:

bintray.gradle

apply plugin: 'com.jfrog.bintray'
apply from: '../bintray.data.gradle'

version = libraryVersion

if (project.hasProperty("android")) { // Android libraries
    task sourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }

    task javadoc(type: Javadoc) {
        options.addBooleanOption('Xdoclint:none', true)
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    }
} else { // Java libraries
    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives javadocJar
    archives sourcesJar
}

Properties properties = new Properties()
properties.load(new FileInputStream(file(rootProject.file('local.properties'))))

bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']
    pkg {
        repo = bintrayRepo
        name = bintrayName
        desc = libraryDescription
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        userOrg = userOrg
        licenses = allLicenses
        publish = true
        publicDownloadNumbers = true
    }
}

install.gradle

apply plugin: 'com.github.dcendents.android-maven'
apply from: '../bintray.data.gradle'

group = publishedGroupId

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                groupId publishedGroupId
                artifactId artifact

                name libraryName
                description libraryDescription
                url siteUrl

                licenses {
                    license {
                        name licenseName
                        url licenseUrl
                    }
                }
                developers {
                    developer {
                        id developerId
                        name developerName
                        email developerEmail
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl

                }
            }
        }
    }
}

bintray.data.gradle:

ext {
    bintrayRepo = 'maven'
    bintrayName = 'samplename'

    publishedGroupId = 'sample.package.name'
    libraryName = 'SampleName'
    artifact = 'samplename'

    libraryDescription = ''

    siteUrl = ''
    gitUrl = ''

    libraryVersion = '1.0.0'

    developerId = ''
    developerName = 'Zagórski'
    developerEmail = ''

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

Build.gradle of app:

apply plugin: 'com.android.application'

(...)

apply from: '../install.gradle'
apply from: '../bintray.gradle'

main build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

The example project using these classes is here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>