How to update forked GitHub repository?

When you fork GitHub repository, you usually want to have your fork up to date with the original repository. You can update your fork in a few easy steps. Just look at the following example of the Git commands: Add the remote, call it upstream: git remote add upstream https://github.com/whoever/whatever.git Fetch all the branches of that remote into remote-tracking branches, such as upstream/master: git fetch upstream Make sure that you’re on your master branch: ...

November 7, 2014 · 1 min · 108 words · Piotr Wittchen

Versioning Android applications

When we work in a team projects, our code constantly changes and being tested. Often some bugs occur in a specific version of application and no longer exists in next version of the project, because one programmer might fixed the bug according to the Boy Scout Rule and this is good. Nevertheless, sometimes we need to write documentation and check in which version bug occurred to be sure, that it was really fixed. In addition, QA Engineer needs to know, which version of the project he or she should check. That’s why we should introduce versioning system to our project. In Android Manifest we have versionCode and versionName. The versionCode is used for updates on Google Play Store and it has to be integer value. We should increment versionCode before releasing new version of the application for the users. The versionName available in Android Manifest is a string value and we can use it to store information, which we need in a current project. When we use Git as a Version Control System, we can put SHA value of a specific commit into our version name. In addition, we can add date and time of compilation to this variable. After that, our versionName contains very detailed information about current version of our application. Exemplary versionName will look in as follows: f935ea7-20140913144001. We can obtain that with proper configuration of build.gradle file containing buildTime() method and gitSha() method. Please, take a look at creation of versionName in 35th line of the build.gradle file presented below. ...

September 13, 2014 · 2 min · 332 words · Piotr Wittchen

Updating Android XML resources before compilation via Gradle

Problem In a team project, we encountered one of the common problems connected with mobile applications. Android application sends requests to backend web service and we don’t have backend web service deployed right now on a separate server, so every mobile developer is compiling and running backend web service on the local machine for testing purposes. In the beginning, url of backend url looked as follows: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="backend_url">192.168.1.1</string> </resources> Of course address varies on different machines. ...

September 10, 2014 · 3 min · 542 words · Piotr Wittchen