Adapt for multidex handling

With this patch, it is possible to build an application consisting of
more than one dex File, by setting the --multi-dex option in :dex-opts.

For details see
http://blog.osom.info/2014/10/multi-dex-to-rescue-from-
infamous-65536.html
Minor refactoring