Android logo

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 3 4 5 6 7 8 $ 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 ...

Android logo

Start Android locale settings activity 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 adb shell am start -n 'com.android.settings/.Settings\$LocalePickerActivity'

Android logo

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 https://stackoverflow.com/a/24157721

How to compile android emulator on ubuntu 13.10

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

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)

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

How to upgrade Nexus 4 to Android 4.4 Kitkat

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

Android Security related tools

A lot of work is happening in academia and industry on tools to perform dynamic analysis, static analysis, and reverse engineering of android apps. A list of those tools can be seen at https://github.com/ashishb/android-security-awesome.