How to Send APK File Automatically with Beta Crashlytics in Android (Part 1)
Assalaamu’alaykum, Bro.…
Now, I will share about how developers can send APKs to anyone who needs it (semi) directly. In general, the process of sending an APK is carried out by the following steps:
By utilizing Beta Crashlytics, there are some steps we can skip to speed up the process of sending APK. Then, the first thing we have to do is install the Beta Crashlytics plug-in in our application. Open the build.gradle (project) file and embed the following plugin fabric script:
classpath 'io.fabric.tools:gradle:1.27.0'
And finally, it will be like this:
Previously, do not press the Sync button first because it will cause an error. Open the build.gradle (module) file and embed the following script:
apply plugin: 'io.fabric'
And finally, it will be like this:
Notes: You also need to install Fabric Crashlytics dependencies. The method can be seen here.
Beta Crashlytics Documents
Actually the distribution of APK can be done in several ways that you can see here. This time I did the distribution using gradle. There are some data that we have to fill before we can do the APK distribution, including:
1. Release Notes
Is a note or information from each build application and all changes. The form of the script is as follows:
ext.betaDistributionReleaseNotes="Release Notes for this build."
Or you can also use text files like the following:
ext.betaDistributionReleaseNotesFilePath=”path/to/release_notes.txt”
2. Testers
Configure who will receive the APK distribution later. The form of the script is as follows:
ext.betaDistributionEmailsFilePath="beta_distribution_emails.txt"
Or it can also be directly filled in by the email address of each examiner and separated using a comma (,) like the following:
ext.betaDistributionEmails="BetaUser@yourcompany.com, BetaUser2@yourcompany.com"
3. Groups
Is a configuration where we can do Scoping Tester using groups. The form of the script is as follows:
ext.betaDistributionGroupAliases="my-best-testers"
Later it will automatically create a group according to the name pinned. To see the results, go to the dashboard page of the application in fabric.io. Or you can also use other methods, namely using text files. Note that if more than one group, the name must be separated by using a comma (,). The form of the script is as follows:
ext.betaDistributionGroupAliasesFilePath=group_aliases.txt
4. Email Notifications
It is a configuration of email notifications for all testers. The form of the script is as follows:
ext.betaDistributionNotifications=false
If the pinned value is false then all testers will not get an email notification when the APK distribution process is complete. Conversely, if true then all testers will get a notification email.
Variant With Beta Crashlytics
Here I will share two method approaches for the distribution of APKs with and without custom build variants. Here’s the explanation:
A. Without Custom Build Variant
I tried the above script in debug mode. If you want to try it in release mode, don’t forget to pin the key file script (. Jks) like this:
Press the Sync button to synchronize dependencies.
B. With Custom Build Variant
The script above is an example that we have made 3 new environments: production, staging, and development. I tried production in debug mode. If you want to make the APK mode in production release just paste signingConfig signingConfigs.released on block production.
Distribution with Beta Crashlytics
Now it’s time we try to do (semi) automatic APK distribution. The first thing to do is to make the APK and the second thing just do the APK distribution. If we use method A (Without Custom Build Variant), the steps are as follows:
- Open Terminal
- Embed the following script (referred to as the gradle task) to create an APK
./gradlew assembleDebug
Notes: I tried this on the MacOs operating system. Maybe the Windows and Linux operating systems will have different writing characters (. \ | \.) CMIIW.
3. Press the Enter key and wait until the process is complete
4. If successful, the output on the terminal will be like this:
5. Embed the following script to do the APK distribution
./gradlew crashlyticsUploadDistributionDebug
6. If successful, the output on the terminal will be as follows:
That is how I did method A (Without Custom Build Variant) in debug mode. If you want to try method B, in general, the steps are the same, but there is a slightly difference in the name of the script. For example, we want to make a production release APK, the script is as follows:
./gradlew assembleProductionRelease
Then if you want to distribute the APK release, the script is like this:
./gradlew crashlyticsUploadDistributionProductionRelease
So, the difference is only in adding words according to the environment chosen. If all is successful, the testers will get an email from Fabric Crashlytics which indicates all processes have been completed. The visible e-mails will be as follows:
After that, if your friends want to try the APK that has been sent, at the bottom of the e-mail attachment, there is the Let Me In button, press it. Then, press the button Next. You only have to fill your name once and can immediately try the APK that has been successfully distributed.
So, that’s it, the first part of this tutorial on send APK file automatically with Beta Crashlytics in Android. Insyaallah, in Part 2, I will try to combine it with CI/CD (Continuous Integration and Deployment) to make it fully automatic. Hopefully the knowledge is useful.
Wassalaamu’alaykum Warahmatullahi Wabarakatuh….