I actually solved this recently (sample here), mainly via a tutorial here.
The steps:
Prepare the aar file. This you can do using the "assembleRelease" gradle task. You should consider adding Proguard rules too. Example here of some rules that you might want to add.
Create a new Github repository, and upload the aar file there.
Put 2 new files in the repository. One is jitpack.yml (very important to have 2 spaces before the "-", as opposed to what's written on the article) :
install:
- FILE="-Dfile=mylibrary-release.aar"
- mvn install:install-file $FILE -DgroupId=com.lb.sdktest -DartifactId=test -Dversion=1.0 -Dpackaging=aar -DgeneratePom=true
- Another is pom.xml :
<?xml version="1.0" encoding="iso-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lb.sdktest</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
</project>
You should change the "com.lb.sdktest" and "test" according to what you wish, but I think it gets ignored anyway as it's changed automatically on Jitpack according to where it exists (in my case of the sample it changed to implementation 'com.github.AndroidDeveloperLB:SdkTest:7'
)
- On Github, create a new release, go to Jitpack, paste the URL there (example here of what I did), wait a bit for the release to appear, and press "GET" button.
That's it. You will get the new instructions for SDK-users of how to use your new dependency!
EDIT: while this is working fine, I've found some important issues that if someone knows how to fix, it will be very appreciated:
What's the meaning of those extra files? Why does it seem the values there are ignored?
I've noticed that the SDK-user will have to add all dependencies the aar is using. How come? I've read somewhere that for maven plugin, it is the one that generates the pom file, which adds dependencies too. But how can I use it properly for Jitpack? I tried to use it, and indeed it generated a POM file which seem to have the dependencies. I tried to follow all the possible tips and guidelines, but still failed to use it properly. Wrote about this here.
Even though I've added many KotlinDocs (JavaDocs but for Kotlin), those get completely removed on the way to generate the AAR file. I have no idea how to preserve them in any way. Choosing to generate it manually (via the IDE there is a way to generate JavaDocs), it didn't succeed as it said there are no Java files. How can I generate those and make them available for SDK-users?
As it became obfuscated, I've noticed a weird thing: It removed some important parts of Retrofit classes that I've made. I've written about this here, and I just wonder if that's the best way to solve it, or there is a better way.