Table of contents

  1. Android ART can’t set final fields correctly

    January 2016

  2. The generated R class cannot be found (Android Annotations, AA and product flavors)

    May 2015

  3. Android transparent selector drawable doesn’t work

    May 2015

  4. How to Make Building with Gradle Faster

    October 2014

  5. Android .gitignore (Gradle + Android Studio)

    October 2014

  6. Compass + Yeoman

    October 2014

  7. The synchroller component has came out

    October 2014

Content

Android ART can’t set final fields correctly

For example you have class Person. Person is a POJO for REST-service (for instance, for using with retrofit).

class User {
  public static final String firstName = "", lastName = "";
}

This line of code creates two read-only fields. It’s necessary to assign initial values because every field is final. But there’s another way to do the same thing:

class User {
  public static final String firstName, lastName;

  public User() {
    firstName = "";
    lastName = "";
  }
}

It’s hard to believe, but second – is the only right way to create class.

For example, you’re creating class instance:

User user = SomeReflection.getUser();
// user.lastName.equals("Username")
callFunction(user); // in this function user.lastName.equals("") for 1st method

I think it depends on JVM but it’s truth for Android ART.

How to Make Building with Gradle Faster

In the root of your project (in the directory with settings.gradle) create or just open file local.properties and add these two lines:

org.gradle.parallel=true
org.gradle.daemon=true

Compass + Yeoman

There’s an elegant method to connect Compass to Yeoman I couldn’t find in the web.
One line of code
So I just leave this here.

Continue…

The synchroller component has came out

The synchroller component is a mini fake-scroller component for Android designed to be as light and fast, as possible. Sources are available on github.
Now I’m trying to understand how to locate project on jCenter for easy library integration with projects based on maven/gradle.