2016-12-19 7 views
0

Привет, поэтому я следую за сайтом Github Gradle Bintray Plugin https://github.com/bintray/gradle-bintray-plugin#readme, но я не совсем понимаю часть публикаций. Кто-нибудь может мне с этим помочь? В настоящее время я работаю над версией 1.7.3 bintray.Загрузка модуля android в bintray и подключение к jcenter

Обновление: Я смог успешно загрузить в bintray. Однако теперь моя текущая проблема заключается в загрузке ее в другие проекты. У меня есть ошибки при синхронизации градиента:
-Не удается найти android-dbpatcher.jar (sirqo: android-dbpatcher: 0.0.1).
-ошибка: Искал в следующих местах:
http://sirqo.bintray.com/Android-DBPatcher/sirqo/android-dbpatcher/0.0.1/android-dbpatcher-0.0.1.jar

Update2: Для справки это мой 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 '[email protected]' 
       } 
      } 
     } 
    } 
} 

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

https://www.theguardian.com/technology/developer-blog/2016/dec/06/how-to-publish-an-android-library-a-mysterious-conversation – Basi

+0

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

+0

спасибо @Basi плохо попробуйте это. – BradlyMan

ответ

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 
} 

И для моего модуля 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' //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 '[email protected]' //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' 
     } 
    } 
} 

После этого открытого андроида терминала ниже в андроид студии и введите команду

./gradlew install

  • , если есть какая-то ошибка, вы можете добавить команду с --debug и повторно введите команду, чтобы проследить ошибку

// если ничего другого не обязательно использовать эту команду ./gradlew bintrayUpload * снова, если есть ошибка, с помощью которой вы можете использовать команду и добавить ее с помощью --debug для ее отслеживания.

после этого вы получите электронное письмо или что-то еще, а затем сможете перейти к загрузке библиотеки в другие проекты. Счастливое кодирование!

 Смежные вопросы

  • Нет связанных вопросов^_^