Layout inflation and why AppCompat components replace standard ones

Some time ago I saw the following question in StackOverflow: Why does Android select AppCompat components when I don’t declare them explicitly? I was debugging my App and found while hovering on an ImageView reference that, it is an AppCompatImageView instead of an ImageView. The same happened with a TextView(with AppCompatTextView). So, why Android Views get “automagically” converted into AppCompat* equivalents? The answer […]

Android compatibility with 32-bit libraries on a 64-bit device, updated

Sometime ago I wrote the following post: Android compatibility with 32-bit libraries on a 64-bit device. In that article, the proposed solution was to manually remove the library files that were causing the problem using exclude. See that article for the details on the reasons to do that. There’s a better way using ABI Filters, […]

How to specify different buildTypes in Gradle 3.0.0 beta 4 and later

After updating to Gradle plugin 3.0.0 beta 4 our build failed with the following message: buildTypeMatching has been removed. Use buildTypes..fallbacks Our libraries have release and debug buildTypes, but our app has two additional buildTypes: releaseWithLogs and debugMinified. Snippet of our app Gradle file: android { // … buildTypeMatching ‘releaseWithLogs’, ‘release’ buildTypeMatching ‘debugMinified’, ‘debug’ buildTypes […]

Kotlin interop: mixing Kotlin and Java ButterKnife-annotated activities

I’ve been working with Kotlin for a while, mainly for side-projects or toy-projects. Since last Google I/O 2017 announcement it has become clear that there are no more reasons or excuses to not use it in production. One of the big selling points of Kotlin is that you can start small, by converting one class […]

Offtopic: mechanical calculators (cardboard and wood!)

A few days ago I happened to stumble with this fun article of a mechanical 4-bit calculator made in cardboard. Even if it’s quite unreliable, is interesting to see the methodical approach and all the creativity to make this work with only cardboard and marbles. In the comments of the article there is a Youtube […]

Disabling (and removing) code on release builds

Repo updated on 2017-03-13: added additional debug configurations to check different options to enable/disable minification, optimization and obfuscation. See the discussion in Optimize without obfuscate your debug build, including this comment. Sometimes you have to add code to your applications that is used for debugging purposes. This can be very useful, and sometimes is keep there as it […]

Jenkins builds with a different Java version

We have a Jenkins server taking care of CI for an Android project. In the server we were using Java 7, but since we updated a few dependencies we needed Java 8 to run some Gradle plugins. After the change, we suddenly started to get this error in the builds: * What went wrong: A […]

npm install not installing all the packages

A few days ago I was trying to install a project’s dependencies with a simple npm install, but in the instructions I was given there was an extra step to manually install one additional package. When I checked package.json, the package was there… So, what was going on!? After searching for a while, it turns out that […]

Fixing Python virtualenv on OS X

This weekend I’ve been toying with an old project I created in Django a while (~2 years) ago. The project uses virtualenv, as commonly happens in this kind of projects. The original project was created originally on a different machine, and migrated to the current one. Original machine had OS X Lion, I think… or Snow […]

Problems with Instant Run (Android Studio 2.0 beta 4) and Retrofit

This morning I was playing with a toy app I have which uses Retrofit, and I’ve found the following problem with it (and Instant Run): 02-16 07:41:55.550 2976-2976/com.test.android A/art: art/runtime/thread.cc:1329] Throwing new exception ‘length=227; index=1017’ with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=227; index=1017 The exception was in the call itself, so it was either Retrofit doing […]