Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将android模块上载到bintray并链接到jcenter_Android_Gradle_Bintray_Jcenter - Fatal编程技术网

将android模块上载到bintray并链接到jcenter

将android模块上载到bintray并链接到jcenter,android,gradle,bintray,jcenter,Android,Gradle,Bintray,Jcenter,大家好,我正在关注Gradle Bintray插件教程的github站点,但是我不太了解发布部分。有人能帮我吗?我目前正在开发bintray版本1.7.3 更新: 我能够在bintray中成功上传。然而,我现在的问题是在其他项目中下载它的时候。我在同步渐变时出错: -找不到android dbpatcher.jar(sirqo:android dbpatcher:0.0.1)。 -错误:在以下位置搜索: 更新2: 作为参考,这是我模块中的gradle.build apply plugin

大家好,我正在关注Gradle Bintray插件教程的github站点,但是我不太了解发布部分。有人能帮我吗?我目前正在开发bintray版本1.7.3

更新: 我能够在bintray中成功上传。然而,我现在的问题是在其他项目中下载它的时候。我在同步渐变时出错:
-找不到android dbpatcher.jar(sirqo:android dbpatcher:0.0.1)。
-错误:在以下位置搜索:

更新2: 作为参考,这是我模块中的gradle.build

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner     "android.support.test.runner.AndroidJUnitRunner"

    }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-  core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.volley:volley:1.0.0'
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath +=         project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

group = 'xxxx'
version = '0.0.1'

install {
    repositories.mavenInstaller {
        pom.project {
            name 'android-dbpatcher'
            description 'A library for updating SQLite database in android.'
            url 'https://sirqo.bintray.com/Android-DBPatcher'
            inceptionYear '2016'

            packaging 'aar'
            groupId 'xxxx'
            artifactId 'android-dbpatcher'
            version '0.0.1'

            licenses {
                license {
                    name "The Apache Software License, Version 2.0"
                    url "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution "repo"
                }
            }

            developers {
                developer {
                    id  'xxxx'
                    name 'xxxxx'
                    email 'xxxxxx@gmail.com'
                }
            }
        }
    }
}

Properties bintrayProperties = new Properties()
    bintrayProperties.load(project.rootProject.file('bintray.properties').newDa    taInputStream())

bintray {
    user = bintrayProperties.getProperty('user')
    key = bintrayProperties.get('key')
    configurations = ['archives']
    pkg {
        repo = 'Android-DBPatcher'
        name = 'android-dbpatcher'
        userOrg = 'xxxx'
        vcsUrl = 'https://github.com/sirqo/android-dbpatcher'
        publish = true
        version {
            name = '0.0.1'
            desc = 'Android SQLite Database Patcher'
            released = new Date()
            vcsTag = 'v0.0.1'
        }
    }
}

所以我想出来了。作为参考,我将分享我的代码

对于我的项目gradle.build

// 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:2.2.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.volley:volley:1.0.0'
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

group = 'xxxx' //bintray org/group name
version = '0.0.1' //version

install {
    repositories.mavenInstaller {
        pom.project {
            name 'xxxxx' //package name
            description 'A library for updating SQLite database in android.'
            url 'xxxxx'
            inceptionYear '2016'

            packaging 'aar'
            groupId 'xxxx' //group/org id
            artifactId 'xxxx' //your android module name
            version '0.0.1'

            licenses {
                license {
                    name "The Apache Software License, Version 2.0"
                    url "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution "repo"
                }
            }

            developers {
                developer {
                    id  'xxxxx' //developer username
                    name 'xxxxxx' //developer name
                    email 'xxxxxx@gmail.com' //developer email
                }
            }
            scm {
                connection 'xxxxxx' // YOUR GIT REPO
                developerConnection 'xxxxxx' // YOUR GIT REPO
                url 'xxxxxxx' // YOUR SITE

            }
        }
    }
}

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

bintray {
    user = bintrayProperties.getProperty('user')
    key = bintrayProperties.get('key')
    configurations = ['archives']
    pkg {
        repo = 'xxxxxx' //Bintray repository
        name = 'xxxxxx' //Bintray Package name
        userOrg = 'xxxxx'
        licenses = ['Apache-2.0']
        vcsUrl = 'xxxxxxxx'
        publish = true
        version {
            name = '0.0.1' //version
            desc = 'xxxxxx' //Description
            released = new Date()
            vcsTag = 'v0.0.1'
        }
    }
}
对于我的模块gradle.build

// 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:2.2.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.volley:volley:1.0.0'
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

group = 'xxxx' //bintray org/group name
version = '0.0.1' //version

install {
    repositories.mavenInstaller {
        pom.project {
            name 'xxxxx' //package name
            description 'A library for updating SQLite database in android.'
            url 'xxxxx'
            inceptionYear '2016'

            packaging 'aar'
            groupId 'xxxx' //group/org id
            artifactId 'xxxx' //your android module name
            version '0.0.1'

            licenses {
                license {
                    name "The Apache Software License, Version 2.0"
                    url "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution "repo"
                }
            }

            developers {
                developer {
                    id  'xxxxx' //developer username
                    name 'xxxxxx' //developer name
                    email 'xxxxxx@gmail.com' //developer email
                }
            }
            scm {
                connection 'xxxxxx' // YOUR GIT REPO
                developerConnection 'xxxxxx' // YOUR GIT REPO
                url 'xxxxxxx' // YOUR SITE

            }
        }
    }
}

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

bintray {
    user = bintrayProperties.getProperty('user')
    key = bintrayProperties.get('key')
    configurations = ['archives']
    pkg {
        repo = 'xxxxxx' //Bintray repository
        name = 'xxxxxx' //Bintray Package name
        userOrg = 'xxxxx'
        licenses = ['Apache-2.0']
        vcsUrl = 'xxxxxxxx'
        publish = true
        version {
            name = '0.0.1' //version
            desc = 'xxxxxx' //Description
            released = new Date()
            vcsTag = 'v0.0.1'
        }
    }
}
在此之后,在android studio中打开下面的android终端并输入此命令

/gradlew安装

  • 如果出现一些错误,可以使用--debug追加该命令,然后重新输入该命令以跟踪错误
//如果没有其他故障,则发出此命令 ./gradlew bintrayUpload *同样,如果出现错误,可以使用命令并附加--debug来跟踪它


在所有这些之后,您将收到一封电子邮件或其他东西,然后您可以继续在其他项目中下载您的库。快乐编码

所以我想出来了。作为参考,我将分享我的代码

对于我的项目gradle.build

// 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:2.2.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.volley:volley:1.0.0'
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

group = 'xxxx' //bintray org/group name
version = '0.0.1' //version

install {
    repositories.mavenInstaller {
        pom.project {
            name 'xxxxx' //package name
            description 'A library for updating SQLite database in android.'
            url 'xxxxx'
            inceptionYear '2016'

            packaging 'aar'
            groupId 'xxxx' //group/org id
            artifactId 'xxxx' //your android module name
            version '0.0.1'

            licenses {
                license {
                    name "The Apache Software License, Version 2.0"
                    url "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution "repo"
                }
            }

            developers {
                developer {
                    id  'xxxxx' //developer username
                    name 'xxxxxx' //developer name
                    email 'xxxxxx@gmail.com' //developer email
                }
            }
            scm {
                connection 'xxxxxx' // YOUR GIT REPO
                developerConnection 'xxxxxx' // YOUR GIT REPO
                url 'xxxxxxx' // YOUR SITE

            }
        }
    }
}

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

bintray {
    user = bintrayProperties.getProperty('user')
    key = bintrayProperties.get('key')
    configurations = ['archives']
    pkg {
        repo = 'xxxxxx' //Bintray repository
        name = 'xxxxxx' //Bintray Package name
        userOrg = 'xxxxx'
        licenses = ['Apache-2.0']
        vcsUrl = 'xxxxxxxx'
        publish = true
        version {
            name = '0.0.1' //version
            desc = 'xxxxxx' //Description
            released = new Date()
            vcsTag = 'v0.0.1'
        }
    }
}
对于我的模块gradle.build

// 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:2.2.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.volley:volley:1.0.0'
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

group = 'xxxx' //bintray org/group name
version = '0.0.1' //version

install {
    repositories.mavenInstaller {
        pom.project {
            name 'xxxxx' //package name
            description 'A library for updating SQLite database in android.'
            url 'xxxxx'
            inceptionYear '2016'

            packaging 'aar'
            groupId 'xxxx' //group/org id
            artifactId 'xxxx' //your android module name
            version '0.0.1'

            licenses {
                license {
                    name "The Apache Software License, Version 2.0"
                    url "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution "repo"
                }
            }

            developers {
                developer {
                    id  'xxxxx' //developer username
                    name 'xxxxxx' //developer name
                    email 'xxxxxx@gmail.com' //developer email
                }
            }
            scm {
                connection 'xxxxxx' // YOUR GIT REPO
                developerConnection 'xxxxxx' // YOUR GIT REPO
                url 'xxxxxxx' // YOUR SITE

            }
        }
    }
}

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

bintray {
    user = bintrayProperties.getProperty('user')
    key = bintrayProperties.get('key')
    configurations = ['archives']
    pkg {
        repo = 'xxxxxx' //Bintray repository
        name = 'xxxxxx' //Bintray Package name
        userOrg = 'xxxxx'
        licenses = ['Apache-2.0']
        vcsUrl = 'xxxxxxxx'
        publish = true
        version {
            name = '0.0.1' //version
            desc = 'xxxxxx' //Description
            released = new Date()
            vcsTag = 'v0.0.1'
        }
    }
}
在此之后,在android studio中打开下面的android终端并输入此命令

/gradlew安装

  • 如果出现一些错误,可以使用--debug追加该命令,然后重新输入该命令以跟踪错误
//如果没有其他故障,则发出此命令 ./gradlew bintrayUpload *同样,如果出现错误,可以使用命令并附加--debug来跟踪它


在所有这些之后,您将收到一封电子邮件或其他东西,然后您可以继续在其他项目中下载您的库。快乐编码

谢谢@Basi我会试试看。@Basi我有个问题,这是干什么的//把它放在文件的末尾apply from:“”apply from:“”its from谢谢@Basi我会试试看。@Basi我有个问题,这是干什么的//把它放在文件的末尾apply from:“”apply from:“”it from