A Very Simple Android Artifactory Deployment

A Very Simple Android Artifactory Deployment

This article is intended to be a quick guide for getting you up and running with Artifactory. However, if you’re only here because your code doesn’t work, scroll down to the end — maybe that’s the issue?

Abstract

We’ve slowly been moving over from Jitpack to Artifactory at work — it’s a more robust, polished solution for corporate environments. As a result, we’ve been changing the way our build process works which has not been without its challenges. This article is intended to be a quick guide for getting you up and running with Artifactory. However, if you’re only here because your code doesn’t work, scroll down to the end — maybe that’s the issue?

Introduction

If you’re working in the software engineering field, then you’re probably building something. The final output of this something may be a binary file. For example, an Android application is packaged into an APK file. Java applications are packaged into JAR files. Similarly, Android libraries are packaged into AAR files. One can also use JAR files for the last one, however, the convention is to use AAR files since these can include layout files, as well as other resources for consuming Android applications to use.

At some point, you’d probably want to deploy these outputs (artifacts) somewhere, and have that “somewhere” store all of this for you for further consumption. In the JavaScript ecosystem, this is NPM. For Python packages, this is PyPI. Artifactory is similar— it’s basically your own version of these repository services, to which you may upload various artifacts. Do these have to be binary? Of course not — right alongside the APK, AAR, JAR files you can also have JSON, XML, Docker images etc.

Artifactory is considered to be the best (and, erhm, perhaps only) solution for corporate package hosting. It’s been around for a while, and the fact that it follows Apache Maven specifications (as well as others, but let’s forget about those for now) makes it easy to build your project, deploy it, and then consume somewhere else as a dependency.

Image for post

Example dependency inclusion in Gradle

Let’s go over some very basic terms to get everybody on the same page. Right above you can see the dependencies block for a typical Gradle build file. The implementation directive indicates that we are going to need to download whatever (Maven) package is in quotation marks into our project. The syntax of that package is split into 3 parts: the group, the name, and version. All Maven packages follow this convention. Some other examples are androidx.test.espresso:espresso-core:3.3.0 or org.jetbrains.kotlin:kotlin-stdlib:1.4.10.

These terms translate very nicely into the Artifactory UI, as well as the configuration options you specify, so that the build script knows where to push your artifacts to. As a result, this also determines how consumers need to import your projects into their own (which string they will use after their own *implementation *call to download your project).

The name of your artifact becomes the artifactId, the group is the groupId, the version is still…the version. We need to introduce two more things, however: the context URL, and the repoKey. The context URL is the URL of your Artifactory deployment, and the repoKey is the overarching parent for all of your groups. For example, if you have libraryA, libraryB, libraryC, and all of them deal with some kind of network connectivity, you may publish all of those under the network repoKey. Visually, this is what this looks like in the Artifactory web UI:

Image for post

Network repository key, with myGroupId being the group ID, and multiple libraries under it

Another way of thinking about this is if your whole organization is running on one Artifactory instance (most likely it is, the service costs lots of moolah), you firmware team may use one repository key, cloud team another, mobile apps team another.

This is all you really need to know/understand about how Artifactory works (and how it handles artifact lookup) to start integrating it into your application. Let’s do that now.

gradle devops artifactory maven android

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Build Tool for Android Applications

What is Android Gradle -Learn why gradli is used in Android, how it works, what are the features of Gradle, important gradle files and types of gradle.build

Top Android Projects with Source Code

Android projects with source code - Work on real-time android projects. We’ll start project ideas from beginners level and later move to advance projects.

Maven vs Gradle: Which Is Better? | Maven & Gradle Difference

The Maven vs. Gradle will help you understand the contrast between the DevOps tools. What is Maven? What is Gradle? Maven vs. Gradle. We shall finally see the possible procedure to choose between the two DevOps tools, which would be a better fit for your work.

How to Extend your DevOps Strategy For Success in the Cloud?

DevOps and Cloud computing are joined at the hip, now that fact is well appreciated by the organizations that engaged in SaaS cloud and developed applications in the Cloud. During the COVID crisis period, most of the organizations have started using cloud computing services and implementing a cloud-first strategy to establish their remote operations. Similarly, the extended DevOps strategy will make the development process more agile with automated test cases.

Building Dark Mode Theme in Android

Hello World, today we are going to see how we can implement a dark theme or night mode in our android application. This tutorial is going to be very simple and easy to understand. The dark theme is attractive to users and it is comfortable for low light conditions.