Friday, October 31, 2014

Gradle: Working with multi app projects in Android Studio

In this tutorial I wanted to share how is my project organized to work with multiple apps and libraries.

Maven: updating version on Mac

In this tutorial we will discuss upgrading Maven on Mac OS X.

Maven: installing Android SDK

In order to compile Android project using Maven you have to instal Android SDK to your Maven repository.

$ git clone
Cloning into 'maven-android-sdk-deployer'...
remote: Counting objects: 3198, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 3198 (delta 3), reused 6 (delta 3)
Receiving objects: 100% (3198/3198), 435.92 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1585/1585), done.
Checking connectivity... done.

$ cd maven-android-sdk-deployer/

Saturday, October 25, 2014

Thursday, October 23, 2014

Android: reinstalling several APKs from single folder

In this tutorial we will install multiple APKs from your local computer to Android device using ADB connection.

echo "                    ██╗"
echo "██╗   ██╗ ██╗   ██╗ ╚═╝"
echo "██║   ██║ ██╚═██╗═╝ ██╗"
echo "██║   ██║ ████══╝   ██║"
echo "██║   ██║ ██║╚██╗   ██║"
echo "████████║ ██║  ╚██╗ ██║"
echo "╚═══════╝  ╚╝   ╚═╝ ╚═╝"

# Install new APKs
for apk in $(ls *.apk)
    echo "Installing $apk"
    adb install -r "$apk"

Monday, October 20, 2014

Groovy on Android

Android developers are already using Groovy in many places AROUND Android, for example in Gradle build scripts. Now the dream of using Groovy as primary language for Android is a little closer to realization! See what is cooking.

Installing Maven

After few years of not needing it, I came back to Maven, reason being that I cannot use Gradle for reasons beyond my control and Ant does not describe complex projects structures required.

Bash: GIT repetitive tasks

I have too many GIT repos to remember that I need to keep updated, to do that I have a script that updates what I need.

Mac Daemons that hunt us

Sometimes you get annoyed by garbage other companies are trying to stuff on your computer. Motorola is one of these companies. When I connect my test DROID device the annoying popups are opened. 

This is not a conclusive solution, but a start of the longer article on the unwanted Mac Daemons that suck up your patience and CPU power.

Removing Launch services

$ launchctl list | grep moto
- 0 com.motorola.motohelperUpdater
32594 - com.motorola.motohelper
- 0 com.motorola.MDMUpdaterPlist
$ launchctl remove com.motorola.motohelper

$ launchctl remove com.motorola.motohelperUpdater

Removing unwanted Application

cd /Library/Application\ Support/
$ ls | grep Moto

Motorola Mobility
uki@ Application Support $ sudo rm -r MotoCast

uki@ Application Support $ sudo rm -r Motorola\ Mobility/

List of legitimate Services:

  • PTPCamera - part of the Image Capture software that MacOS uses

Sunday, October 19, 2014

Got Droid? - My Android (test) devices

While cleaning my office I decided to make an inventory of my Android devices.

Please note that it is NOT worth testing on anything less than API 8 Android 2.2 Froyo as it is less than 0.7% of the market share,  so it is OK to use support library v7 in all apps you are running. 
I keep my Google ION for "sentimental reasons only.

OSOS versionVersion NameAPI LEVEL% usedMakeModelCPU nameCPU MhzCPU numberflash ROMRAMCamera MpBTRadioscreen heightscreen widthscreen density dpiScreen diagonal inches
Android1.6Donut40HTCGoogle ION / Magic528132quad band unlocked3.2
Android2.2.3Froyo80.7MotorolaDROIDArm Cortex A860015128544802403.7
Android/CM2.3.3Gingerbread MR11011.4BNNookColor10246001617
Android2.3.3Gingerbread MR11011.4HTCVision / Desire Z A7272ARMv7 Scorpion80011.5Gb51252.18004802403.7
Android2.3.4Gingerbread MR11011.4MotorolaDROID2 A955OMAP 3630100018Gb51252.18544803.7
Android4.2.2Jelly Bean1720.7SamsungGT-P7510 Tab 10.1128075216010.1
Android4.1.11720.7HTCOne X11967203204.9
Android4.4.2KitKat1924.5SamsungSM-P990 Galaxy Tab 12.12560160032012.1
Android/CM4.4.4KitKat1924.5OnePlusOne A0001Snapdragon 8014192010804805.5

Android name to version to API level table

  • API 1 (no code name) 1.0  
  • API 1 (no code name) 1.1  
  • API 3 Cupcake 1.5, NDK 1
  • API 4 Donut 1.6, NDK 2
  • API 5 Eclair 2.0  
  • API 6 Eclair 2.0.1  
  • API 7 Eclair 2.1, NDK 3 - support-v7 ActionBar
  • API 8 Froyo 2.2.x  , NDK 4
  • API 9 Gingerbread 2.3 - 2.3.2  , NDK 5 - added some NFC
  • API 10 Gingerbread 2.3.3 - 2.3.7   - added full NFC
  • API 11 Honeycomb 3.0  
  • API 12 Honeycomb 3.1  , NDK 6
  • API 13 Honeycomb 3.2.x  
  • API 14 Ice Cream Sandwich 4.0.1 - 4.0.2, NDK 7 - added NFC: Android Beam
  • API 15 Ice Cream Sandwich 4.0.3 - 4.0.4 , NDK 8
  • API 16 Jelly Bean 4.1.x  
  • API 17 Jelly Bean 4.2.x  
  • API 18 Jelly Bean 4.3.x  
  • API 19 KitKat 4.4 - 4.4.4  
  • API 20 Android Wear devices
  • API 21 Lollipop 5.0 API level 21

My devices spreadsheet

Saturday, October 18, 2014

Thursday, October 16, 2014

Android: ListViewSwipeActivity ListView with swipe detection

In this tutorial we will explore writing and using ListView that extends support-v7 ActionBarActivity and detects side-to-side swipes and touch events.

8a. Android: populating ListView from the Databse

In this tutorial we will expand on the previous example showing basic SQLite CRUD methods. We will populate a list with results from the database.

Wednesday, October 15, 2014

7b. SQLite CRUD - BookShelf app

In this tutorial you will learn basic SQLite CRUD  functions (Create, Read, Update, Delete) for database operations. Actually, we will use Save, Fetch, Update and Delete method names.

Saturday, October 11, 2014

7a. Android: Shared Preferences: saving and fetching persistent data

In this tutorial you will learn how to save and retrieve user preferences.

IntelliJ IDEA 13: error preventing Android project compilation

4:00:12 AM Throwable: Cannot generate protobuf files as the path to protoc has not been set. Please set in Settins > Compiler
4:00:12 AM Compilation completed with 0 errors and 0 warnings in 0 sec

Not resolved

Friday, October 3, 2014

5d. AndroidStudio: convert to lower/upper case

This tutorial shows you how to change the code lower/upper case of code in Android Studio.

5c. Android: Fragments

When part of your screen has to change layout based on the application logic it is a good practice to use Fragments. For example, user changes convertor type from "length" to "colors" which has very different UI layout, some of the the screen (Activity) will remain the same, but the conversion input will be a different Fragment.

Wednesday, October 1, 2014

Eclipse: export and import preferences

When you work in multiple Eclipse workspaces recreating your preferences is time consuming, to avoid this you can quickly export your set-up and next time you create a workspace import it.