Upgrading Gradle to the latest version on Ubuntu

(Updated November 22, 2014)

Ubuntu 12.04.3 has an old version of Gradle (1.0-milestone-3 from September 2011) installed by default.  To upgrade to a later version of Gradle, you can use Cheng-Wei Chien's PPA for Gradle at by issuing the following commands:

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update

Setting a system property in Gradle

Java system properties can be specified in Gradle by creating a file in one of these locations:

  • $HOME/.gradle/

And creating a property name that's prefixed with systemProp. For example, to set a system property called appengine.sdk.root, you'd create a file with this contents:


What is Groovy?

I started looking at Groovy the other day while trying to understand how Gradle works.  Here are some initial impressions:

What is Gradle? (comparison of gradle vs ant vs make)

Gradle is a build tool similar to make or ant which is being adopted by the Android project as a replacement for ant scripts and the automated "build" step in Eclipse.

There's a useful book about Gradle available online for free at

Here is a comparison between gradle and two other commonly used build tools:

Android SQLiteOpenHelper onUpgrade()

It's not necessary to wrap your SQLiteOpenHelper.onUpgrade() code in beginTransaction() and endTransaction() pairs, because ever since the earliest version of SQLiteOpenHelper, the Android source code has done this for you:

Query the COUNT of rows in a SQLite table in Android

There's a function DatabaseUtils.queryNumEntries() which can be used to query SELECT COUNT(*) FROM table; in a SQLite database in Android.


The Google Analytics SDK for Android v3 (Beta) does not support Android 1.5 (API version 3).  When you try to call EasyTracker.getInstance(this).activityStart(this); you will get this error:

java.lang.IllegalStateException: attempt to acquire a reference on a close SQLiteClosable

"java.lang.IllegalStateException: attempt to acquire a reference on a close SQLiteClosable" can occur in an Android program if you try to do an operation (like run a .query()) on a SQLiteDatabase object which has already been

Regression testing sqlite database migrations in Android

One strategy to test Android sqlite database upgrades is to make a copy of your SQLiteOpenHelper class each time you create a new database version. That way, you can use the older revisions of SQLiteOpenHelper to create legacy versions of your database schema and make sure that when you open the database with newer versions, the upgrade works properly.

3D models from a single photo


Subscribe to RSS - Tech