Библиотека Publi sh android с репозиторием kotlin dsl в maven - PullRequest
0 голосов
/ 21 января 2020

У меня есть Android библиотека написана в Kotlin. Его файл build.gradle записан в kotlin -dsl. Я хочу опубликовать sh мой собственный репозиторий maven, работающий на Jfrog. Библиотека успешно опубликована, но я не могу найти свою библиотеку в примере приложения.

Это файл библиотеки библиотеки. Этот номер версии получен из модуля buildSr c.

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'

android {
    compileSdkVersion Android.compileSdk

    defaultConfig {
        minSdkVersion Android.minSdk
        targetSdkVersion Android.targetSdk
        versionCode Android.versionCode
        versionName Android.versionName
    }

    buildTypes {
        release {
            minifyEnabled true
        }
    }

    dataBinding {
        enabled = true
    }
}

dependencies {
    api AndroidX.appCompat
    api AndroidX.recyclerView
    api AndroidX.motionLayout
    api Libraries.rxAndroid
    api Libraries.material
    api Libraries.koin
    api Libraries.koinScope
    api Libraries.koinViewModel
    api Libraries.lifecycleExtensions
    api Libraries.ktxCore
}

def libraryGroupId = 'com.abc.framework'
def libraryArtifactId = 'ui'
def libraryVersion = '0.0.1-SNAPSHOT'

publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version libraryVersion
            artifactId libraryArtifactId

            artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
        }
    }
}

artifactory {
    contextUrl = 'http://mymavenrepo.com:8081/artifactory'
    publish {
        repository {
            repoKey = 'libs-snapshot-local'

            username = artifactory_username
            password = artifactory_password
        }
        defaults {
            publications('aar')
            publishArtifacts = true

            properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
            publishPom = true
        }
    }
}

Вот мой пример файла с приложением.

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.abc.sampleapp"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.abc.framework:ui:0.0.1-SNAPSHOT"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

1 Ответ

0 голосов
/ 21 января 2020

Удаление «minifyEnabled = true» в файле library.gradle решает проблему.

...