Saturday, 15 November 2014

How to properly configure Gradle to work with Android tools

Well, suppose that you are working with Gradle and Android and then the build stops with a message like this

Could not create plugin of type 'AppPlugin'

Ok, is really annoying. This is because we are not using the "proper" version of Gradle with Android. Even up to this date Gradle is already to the version 2.2 and Google still hasn't fixed it. Well, it seems that the Gradle version that works with Android tools are 1.10, 1.11 and 1.12. In my case I use the version 1.12.

I'll be working with GNU/Linux (doesn't matter the version and distro) but I think this article can be extrapolated to other OS.

Let's assure that we have enabled the Android Support Repository. So from Android Studio, Eclipse or another mean initialize the SDK Manager and look for Extras | Android Support Repository and install it if not is installed.

Let's remember we are working with Linux and our particular version of Gradle is extracted to a local directory to work with. Let's touch the environment variables.

Use your favourite text editor (mousepad, pluma, etc) and open ~/.bashrc and add these lines

export ANDROID_HOME=<path where the Android SDK is>
export GRADLE_HOME=<path where our Gradle version is>
export PATH=${PATH}:${GRADLE_HOME}/bin

With ANDROID_HOME we avoid another Gradle error of the type
Ambiguous method overloading for method
Ok, save and reopen our bash terminal to work with gradle scripts. It should works fine from now.

Tuesday, 11 November 2014

Learning Google Play Services

I'm following the tutorial to implement Google Play services on the game. Sincerely I don't like do this beacuse I feel I'm losing my time but is necessary to understand better what I'm doing with the Google Play API.