Setting up Dryrun- Android Libraries testing done right
Hello everyone, I hope you are doing well. This post is about dryrun. Dryrun is a tool to test new android libraries hosted online directly from your Command Line or terminal. Stick around and we will be setting up dryrun to test android libaries the right way.
TRY ANY ANDROID LIBRARY HOSTED ONLINE DIRECTLY FROM THE COMMAND LINE Dryrun Github Repository
Now, as an Android Developer, there’s just too much going on around to be worried about testing libraries hosted online, from Github or other sources. You cannot be worried about finding the right library for you when you have to develop some new feature on your android app that requires, let’s say, image cropping. This is a common task and you should be able to find a lot of libraries which have been developed by other developers. You should also be able to test them and find the one that suits your needs. Now if you do not use a tool like dryrun, you will have to clone the repo, build it and run the sample on your phone. Mind you, you will have more headache if your gradle version are not inline with the libarary code.
Dryrun to the rescue
Given a scenario where you have found out some libraries that kind of fit your needs. Dryrun will help you test those libraries in no time, so you will be able to choose the one or at least narrow down to one or two. While dryrun runs, you can also be working on other features or parts of your android project.
Let us now discuss how you can setup dryrun
Step 1:
Dryrun is written in Ruby programming language and there is a term known as gem which are like packages or plugins. To install dryrun on your machine, you therefore need gem installed.
To install gem on your windows machine, please visit Gem Windows Installer and install the 32-64 bit installer depending on your machine. Please maker sure to download the devkit version.
After the download is complete, run the executable file.
Step 2
The next step would be to verify that you have Ruby setup correctly on your machine. To do that, simply run the command below in your cmd. (Windows+R, type cmd and enter)
ruby --version
If you get an output like the following with ruby version, you are all set:
ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
If however you did not get the above output, you can check your Environment variables to see if Ruby is set in your Path. To check that, press Windows+R, type “sysdm.cpl” without the quotes and press Enter. This will open System Properties dialog, navigate to Advanced tab and open Environment Variables which is at the bottom.
Select “Path” there from User Variables for
If there is a path entry like C:\Ruby24-x64\bin (which is the default installation directory on Windows) in there, the path to ruby is correctly setup. If there is no such entry, click on New and add the path to your Ruby installation followed by the bin directory. Click on Save and restart your PC.
Step 3
If ruby is correctly setup in your system, you should now be able to setup dryrun in your PC. To do that run:
gem install dryrun
This will install the dryrun gem in your PC and you will be all set to test some exciting libraries in your machine with just a line of code in your command line while you are parallely working on your project. Isn’t that sweet?
Now make sure that your android device is connected to your computer, has developer options enabled and USB debugging on and run the following command to test a library hosted on github.
dryrun https://github.com/cesarferreira/android-helloworld
The command will take some time, but at least you do not have to worry about downloading the zip or cloning, building the project in your android studio, dealing with different gradle versions and then testing on your device. This is all handled by dryrun.
If you ran the above dryrun command you should be abe to see a Hello World from the dryrun’s demo library. Let us now see if we can test this really cool UI library from ramotion which is hosted in the github.
Url here: https://github.com/Ramotion/folding-cell
To do that I will just run :
dryrun https://github.com/Ramotion/folding-cell-android
As you can see the dryrun has started and it will fetch all the files to setup. It even picks the connected android device and installs the library demo.
On Completion of dryrun command you will be able to see something like the following:
As stated here you can run adb uninstall “com.ramotion.foldingcell.examples” to uninstall the current demo, or you can do so from your phone too.
After dryrun has finished everything, it will start the demo app on your android device as it did in mine:
As you can see, I can now test the library on my phone without any hassle that were previously there.
I hope you were able to setup dryrun in your PC. The process is pretty much the same on Mac and Linux except for step 1 and 2 which are for setting up Ruby and setting environment variables. If you need any help with the things mentioned here, do comment here or reach out to me. I hope dryrun helps you make your development faster and less painful.
Thank you and have a nice one!!!