We all know that success of android is mostly because of it’s open source ecosystem. The OS it self is open source, and on the top of it many libraries we use(d) are open source. And all of them help us to create awesome applications in very short time. And as an aspiring developer we all would like to contribute our bit in those opensource projects. This post will shed some lights on this topic in a bit.
I have stumbled on this post on reddit where the OP wanted to start contributing on some open source projects. And just like him, I am also a newbie in this area, but contributing to one open source project and facing some issues in merging1 I have learned some tricks and here are they.
N.B.: In this post I assume you work on Android Studio and most of the libraries are either on github or on bitbucket
The first trick is to find a library to improve. For that the first and important place is to get the libraries you use. Then see the library’s code and it’s issue tracker. If you find any open issues that you can solve or any non reported thing that may improve that library, fork it and start working on your code.
If you don’t have the one in your mind, just go to android-arsenal.com. They have a big collection of libraries on any topic. Just pick one and start improving. One more thing to note is to check readme of the library, there are some developers like me who have a roadmap or some kind of to-do list. If you can work on that, a unicorn and a sweek kitty is born somewhere ;)
Now you have got a library to work on, picked some issues and you have started working on them. After completing your work, you test it and viola! your code is ready to be merged. But before it always check if the library has a code style or not. If the developer(s) have defined it, download it and apply it in your studio. And before doing final push, re-arrange your code according to code style. If you don’t do that, chances are high that your code and the original repo code will be difficult to merge, and just like mine, your pull request can be rejected.
If you are a developer and want ease in merging a code, always define a code style and export them as jar file from your andrdoid studio. If you do not have code style to use, you can start from AOSP’s intellij code stylecode style or Novoda’s code stylecode style which they have exported as jar2
After working a code and publishing it in your fork, always do the pull request. Because we don’t want just another library which essentialy does the same task.3. If you have strong reasons(like inactive developer, or not having public maven repo) you can treat your fork as main library itself. If there is nothing wrong in your code and merging, chances are high that your changes will be there in next version of that library.
This is what I have learned from contributing the library and failing once to do that. I hope as a contributors and as developers you won’t face any problems when you are contributing to an open source project.
As of 8th March 2015 the changes are merged with main repository and v 3.0 contains these changes. Thanks Dino for your patience and your helping. ↩︎
Exporting jar is always a friendly options, if you want to use xml like aosp, you have to put it in a designated folder and restart the ide. With jar a simple import will work. ↩︎
Like play store, github is also being crowded by forked and duplicate libraries, look at the image loading libs for the example. ↩︎