Category Archives: Android

Git Dependencies in Gradle

I found it a pain to get git dependencies working in Gradle, so I decided to write this ugly blog post for my future self and possibly some other desperately-searching Android developers.

The problem:

Including git project dependencies (e.g. a common library among your apps).

The solution:

Add this to your root build.gradle:

 

To your root settings.gradle:

 

To your app build.gradle:

 

And that is it!!

To update the library, you can just go to the root build/library/ and run a git pull.

Thanks goes to:

ajoberstar for suggesting the Grgit.clone method (http://stackoverflow.com/questions/13719676/gradle-how-to-clone-a-git-repo-in-a-task)

athor for explaining how to neatly include projects in settings.gradle (http://stackoverflow.com/questions/25186187/gradle-module-and-git-submodule)

 

Coloured output for ADB logcat

I always love nice colour coded debug messages, but all of the adb wrappers that currently exist seem to be far more complex than they really need to be.

So I rigged up this little bash script to neatly colour logcat.

As a bonus, you may specify your application tag name as the first argument to only show the output for messages with that tag. Note that it will also only show error-level messages from AndroidRuntime. (This is so that stack traces will be visible and such).

 

Simulate Android D-pad through ADB

Recently, I had to deal with testing D-pad functionality in my app. Unfortunately, my device doesn’t have a D-pad.

So I rigged up this little script to simulate a dpad from the console of my desktop.

 

It is an interactive script with no command line arguments.

Usage:

Insert: Begin text insert mode.

Arrows: D-pad

Enter/Space: D-pad middle button

 

Enjoy.