Thing to remember while importing Android Open source projects

Pawan Pal
AndroidPub
Published in
2 min readMay 16, 2017

While starting new projects, we have lots of options of open source projects we can use as modules in our projects. Same as we are rebuilding FOSSASIA’s Phimpme Android project. We divide the app ideas in to different broad category. Now to speed up the process, we are using some existing resources such as Open Camera app for Camera features and Leafpic for photo gallery.
Integrating many Big projects into one is also a crucial step, but not much difficult. Here are some points to ponder.

Image source
  1. Clone project separately. Build project and note down the features which you want to integrate. Explore the manifest file to know the Launcher, services and other permission app is taking.
  2. Follow Bottom Up approach while integrating. It makes life easier. By the bottom up approach I mean create a new branch and then start deleting the code which is not required. Always work in branch so that no code lost or messed up.
  3. Remove and Commit, In a big project things are interlinked so removing one feature, actually made you remove most of the code. So my strategy is to focus on one feature and when it removed commit the code. This will help you in a reset hard your code anytime.
  4. Licensing: One thing which is most important in using open source code is their License. Always follow what is written in their License. This is the way we can give credit to their hard work. There are various types of licenses, three famous are Apache, MIT and GNU General Public License. All have their pros and cons.
  5. Aware of File Duplication, sometimes many files have same name which results in to file duplication. So refactor them already in the code.
    Resolve package name. This is also one of the tedious task. Android Studio already do a lot of refactoring but some part left.
  • Make sure your manifest file contains correct name.
  • The best way to refactor your package name in xml file is to ctrl+Shift+f in Ubuntu or Edit → Find → Find in path in Android Studio. Then search old package name and replace it with new. You can use alt+ j for multi cursor as well.
  • Clean and rebuild project.

Run app at each step so that you can catch the error at a point. Also use debugger for debugging.

--

--