Search code examples
androidimportmodulejitpack

Android/Jitpack: Unable to import submodule


I'm trying to import a submodule of an android library I'm creating. The sub-module is called progressbar

https://jitpack.io/#SomeKoder/Essentials/0.1.0

https://github.com/SomeKoder/Essentials

dependencies {
    implementation 'com.github.SomeKoder:Essentials:0.1.0'
}

I've tried this and many other variations without success.

dependencies {
    implementation 'com.github.SomeKoder.Essentials:progressbar:0.1.0'
}

Can someone help me figure out what I'm doing wrong please? Thanks in advance


Solution

  • Adding this to the modules build.gradle led to the artifacts actually building:

    plugins {
        id 'com.android.library'
        id 'kotlin-android'
        id 'maven-publish'
    }
    
    afterEvaluate {
        publishing {
            publications {
                release(MavenPublication) {
                    from components.release
    
                    groupId = 'com.somekoder.Essentials.progressbar'
                    artifactId = 'progressbar'
                    version = '0.1.4'
                }
                debug(MavenPublication) {
                    from components.debug
    
                    groupId = 'com.somekoder.Essentials.progressbar'
                    artifactId = 'progressbar-debug'
                    version = '0.1.4'
                }
            }
        }
    }
    

    It seems you must add a variant of this code in every module you wish to create an artifact for. Then importing through JitPack works fine.