Category: Programming

  • Auto-increase Build number in Xcode

    There are lots of tutorials online showing how to implement automatic Build number increase in Xcode. The simplest one is adding a new Run Script Phase to Project Build Phases and inserting agvtool bump. Unfortunately, I found that this causes a strange issue when the project build randomly stops at the very end and just shows Build Cancelled…

  • Android Device Monitor can’t access data folder

    Issue Android Device Monitor doesn’t have permissions to access data folder and it appears to be empty when trying to open.

  • Arduino – Calculate Person’s Age in Years, Months, Days

    Here is code I recently used to calculate persons age in Years, Months, and Days on Arduino: #include “RTClib.h”RTC_DS3231 rtc; // Using DS3231 Real Time Clock DateTime now = rtc.now(); // Current Date and TimeDateTime dob = DateTime(1984,8,16,0,0,0); // Date of Birth (1984.08.16 00:00:00)int t0 = dob.year() * 12 + dob.month() – 1;int t =…

  • The WIFI_SERVICE must be looked up on the Application context…

    Issue Generating signed APK in Android Studio 2.3 fails with following error: Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing  to .getApplicationContext()  [WifiManagerLeak]

  • ListView Pop-Up Context Menu broken in Android 7 (API 24)

    Issue ListView context menu pop-up doesn’t work properly in Android 7.0 and 7.1 Nougat (API 24 and API 25). Instead of the full menu appearing in the middle of the screen, it now appears collapsed to a single item and either at the very top or at the very bottom of the screen. Here is…

  • The number of method references in a .dex file cannot exceed 64k

    Gradle build fails with error “The number of method references in a .dex file cannot exceed 64k “ As the error suggests you cannot have more than 64k methods in one classes.dex file. One way around this is to use enable MultiDex in your build.gradle multiDexEnabled true

  • java.lang.OutOfMemoryError: GC overhead limit exceeded

    After upgrading Google Play services library from 9.4.0 to 10.2.0 Gradle build fails with following error: Information: Gradle tasks [:app:assembleDebug]Error: UNEXPECTED TOP-LEVEL ERROR:Error: java.lang.OutOfMemoryError: GC overhead limit exceededError: Execution failed for task ‘:app:transformClassesWithDexForDebug’.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationExceptionInformation:BUILD FAILED

  • Android Studio – bindView called multiple times for each listView row

    Issue bindView inside a custom CursorAdapter is called 6-7 times for each row. Resolution There is no direct way to control when bindView is called. Android operating system does it as and when required it in order to properly measure and draw the layout. In this particular case the issue was caused by setting layout…

  • Get Google Maps Distance Matrix API Key

    Follow these step-by-step instructions to get a free Google Maps Distance Matrix API key to be used with Pebble Traffic and Weather watchface. Go to https://console.developers.google.com/apis/api/distance_matrix_backend and login with your google/gmail account Click Create project

  • Pebble – Traffic and Weather

    Support forum Pebble watch face page Instruction for obtaining Google Maps API Key Subscribe to receive updates about new features  

  • UWP VisualStateManager Adaptive Triggers don’t work inside Data Template

    Issue VisualStateManager Adaptive Triggers do not work when placed inside a ListView Data Template. Resolution The issue was resolved by wrapping DateTemplate content inside <UserControl>, something like this:

  • TextView doesn’t respond to click events (Android Studio)

    Issue On some devices clicking on TextView control doesn’t trigger onClick event. Out of handful of devices I used for testing it was affecting only Samsung Galaxy S4 Mini (Android 4.4.2).