Creating & Publishing an Android Library (.aar) to Maven Jitpack Repo | Android Studio #android



Creating & Publishing an Android Library (.aar) to Maven Jitpack Repo | Android Studio #android

Creating & Publishing an Android Library (.aar) to Maven Jitpack Repo | Android Studio #android

Creating & Publishing an Android Library (.aar) to Maven Jitpack Repo | Android Studio #android

#jitpack #android #androidstudio #maven #aar #github #apple #programming #java #kotlin #mac #macos #m2pro #sonoma

*Long Story Short*
Step 1: Create an Android Project in which we will be creating our new Android Module/ Library. Build and run the Android Project on an Android Device /Emulator.

Step 2: Create an Android Library and add it as dependency to our Android project. Implement some logic to this library. To test this library is working, import it in Android project and try to call it’s public method.

Step 3: Create Github repository to upload our project source code. Open https://jitpack.io and login into it using the same Git Account on which we created the repository.

Step 4: Build our library & create an AAR file which we would be publishing to Maven Repo. Configure Jitpack.yml & POM.xml files. Commit all these files to our Git Repo.

Step 5: Before publishing to Maven Repo directly, lets first try to publish the library to localMaven using the gradle command:
./gradlew publishMavenPublicationToMavenLocal

Step 6: Create & publish a new release on the Github using the AAR File which we have committed earlier. After creating this release, go back to Jitpack dashboard, check for the latest releases. Jitpack will automatically starts building the library, once done successfully you’ll see the icon in green on Jitpack. You can also check the log dumped by Jitpack while building and publishing the library.

Step 7: Create a separate Android Project and use the newly published library as Maven Dependency in app’s build.gradle using the implementation syntax. Exploring source code of our library and importing & using it in our project.

————————————-

*Link to Files used*
Download files: https://drive.google.com/file/d/1z612_3Pdi7l6Ul2JgHoS_sVODo6jFZI5/view?usp=sharing

————————————-

*Credits*
– Apple: macOS & Video Made with Final Cut Pro

– Music: Fluidscape by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. https://creativecommons.org/licenses/by/4.0/
Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100393
Artist: http://incompetech.com/

————————————-
*Commands Used*
Gradle:
– publish module to local maven: ./gradlew publishMavenPublicationToMavenLocal
– list all available tasks: ./gradlew tasks

Git:
– initialize git: git init
– add remote url: git remote add origin “REPO_URL”
– check remote url: git remote -v
– add all the files: git add .
– push to git: git push (–force)

————————————-

Thanks ❤️ for checking out this video, hope this helps.

Comments are closed.