Application Not Responding (ANR)

Demystifying Android rendering: Jank and ANR

Almost everyone developing an Android app has seen something like this in their device logs. Bash 1 I/Choreographer(1200): Skipped 60 frames! The application may be doing too much work on its main thread. On most devices, the Android platform tries to render a new frame every 16 milliseconds (60 fps). The rendering requires that whatever work is happening on the UI thread should finish in that timeframe (well, actually in less than that). Any unit of work (== Runnable) scheduled on the UI thread has to fit in that. When the work takes longer, then frames are skipped. One skipped frame is 16 ms of the hung screen. The UI looks janky and unresponsive and if the user interacts with the screen and the application does not respond in time ( 5 seconds) then Application Not Responding (ANR) shows up. ...

Built-in "Developer options" in Android

Android has a few really good settings built right into the platform for debugging under a hidden “Developer Options” menu. You can turn them on via Settings -> About Phone -> Build Number (tap 7 times). The steps will be similar but might vary a bit across OEMs. In older versions of Android, this used to be an explicit option under the Settings tab. I find the following options to be useful for the development ...

Thoughts on Tizen

Users won’t buy a phone till they know that their basic set of apps is available on the device. That pretty much rules out players like BlackBerry 10, Jolla, Ubuntu OS, and Firefox OS. Even Microsoft is still struggling. OEMs like Samsung, HTC, LG, and Sony have been hit hard by the commoditization of Android. Google makes money from Google Play, cheaper phones imply more users. So, the commoditization of Android OEMs is good for Google. These OEMs have to customize Android as per Google’s requirements which have increased over time. They cannot manufacture a competing version of Android (like Amazon’s Fire Phone) either. This leaves us with iOS and Google-experience Android duopoly. The only way to break that duopoly is Samsung, which is big enough that it can convince major developers to develop apps for its devices and throw money at marketing to reach out to end users. It can make money from selling devices as well as selling apps (via the app store). A completely open-source OS can pull open-source developers from GNU/Linux and Android to develop it. A completely open-source OS can convince other OEMs to use it and in lieu, they can partner with Samsung on app store revenue sharing. It remains to see what Tizen’s delayed launch eventually leads to but it’s a matter of survival for Samsung. ...

Android command-line: gradle and testing

For android projects, some engineers use Android Studio (new), some use Eclipse with ADT (old), few like me still savor command line, this blog post is about handling (building, installing and testing) android projects from command line. To create android project Sh 1 2 $ android create project --target 4 --name TestAndroidApp --path ./test_android_app --activity Main --package net.ashishb.TestAndroidApp --gradle --gradle-version 1.0.+  ... After changing to directory test_android_app (cd test_android_app), fix a bug ...

How to start locale settings activity on android from command-line

A useful and handy command specially when you during experimentation, you are stuck because of a changing language settings to an undecipherable foreign language. Bash 1 2 3 adb shell am start -n \ 'com.android.settings/.Settings\$LocalePickerActivity'

Android, Gradle and compile-time only dependencies

Android plugin for Gradle does not support Java-style compile time only dependencies. After spending a few hours on trying to build android app targeted for Amazon SDK (without using Amazon’s Android specific plugin but just their jar stubs for maps, ADM and Home widget), I finally found that the one way to support compile-time dependencies is following. For application project Groovy 1 2 3 4 5 6 7 8 9 10 11 12 13 configurations { provided } dependencies { // ... provided fileTree(dir: "${project.rootDir}/path_to_libs_dir", include: '*.jar') } // Android's version of sourceSets.main.compileClasspath android.applicationVariants.each { variant -> variant.javaCompile.classpath += configurations.provided } For the library project Groovy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 configurations { provided } dependencies { // ... compile fileTree(dir: 'libs', include: '*.jar') provided fileTree(dir: "${project.rootDir}/patch_to_libs_dir", include: '*.jar') } android.libraryVariants.all { variant -> // Exclude the jar files from making its way into the final apk. // Irrespective of what the path_to_libs_dir is the final jar files end up in libs dir. variant.packageLibrary.exclude('libs/lib1.jar') variant.packageLibrary.exclude('libs/lib2.jar') // ... } References https://stackoverflow.com/questions/16613722/gradle-configurations-not-working-as-expected-in-new-android-build-system http://stackoverflow.com/a/24157721

How to compile android emulator on ubuntu 13.10

I was trying to make some modifications to android emulator and was unable to find good set of instructions for the compiling the same. Here are mine. Bash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Get the source code. git clone https://android.googlesource.com/platform/external/qemu cd qemu # Install required dependencies. sudo apt-get install gcc-multilib libesd0-dev libx11-dev \ libxext-dev libasound2-dev libpulse-dev \ lib32stdc++-4.8-dev # Install ia32 libraries (missing from default ubuntu 13.10). sudo apt-get install libgtk2.0-0:i386 libpangox-1.0-0:i386 \ libpangoxft-1.0-0:i386 libidn11:i386 libglu1-mesa:i386 # Configure and build the emulator binary. ./android-configure.sh --no-gles --no-tests --cc=/usr/bin/gcc make -j16 # The emulator binaries are in objs directory.

Why Nokia's (rumored) Android phone is doomed

In Feb 2014, WSJ is reporting that Nokia is working on an Android phone. In Sept 2010, Anssi Vanjoki, outgoing head of Nokia’s smartphone division, likens mobile phone makers that adopt Google’s software to Finnish boys who “pee in their pants” for warmth in the winter. Temporary relief is followed by an even worse predicament. [ source] As someone who has advocated Android for Nokia in the past, I think its just too late now to do that.

Random Thoughts: Android launchers (home screens)

I have used Cover and Aviate but could not stay with either and am back to Nova (which offer static screen of apps).

How to upgrade Nexus 4 to Android 4.4 (Kitkat)

Some experience with adb and fastboot preferred (they are part of android SDK)