Disable `lint` in Android gradle

Surely you can do this by adding this line in your gradle.properties file: gradle=build -x lint -x lintVitalRelease Warning: The above line will prevent running lint for both debug and release builds! If you want to find out more gradle hacks, speedy builds, performance improvements, this will be the best slides you’ll be looking at: … Read more

Using FloatMath or Math and a cast?

As you can see from the results below, using java.lang.Math is faster for floats than for doubles, and faster than FloatMath. Furthermore, FloatMath has no .exp() or .pow() prior to API level 17. On a Samsung GT_i9295 (4.2.2), 2^24 cycles Math.exp(D) Total: 7405 ms, Per Op: 0.0004414 ms (F)Math.exp(F) Total: 5153 ms, Per Op: 0.0003071 … Read more

Understanding @SuppressLint(“NewApi”) annotation

@SuppressLint(“NewApi”) is an annotation used by the Android Lint tool. Lint will tell you whenever something in your code isn’t optimal or may crash. By passing NewApi there, you’re suppressing all warnings that would tell you if you’re using any API introduced after your minSdkVersion See a full list of Lint checks – including “NewApi” … Read more

Retrolambda: Lint crashes when using lambda expressions with retrolambda

You can use a special lombok version with lint which does not whine about Java 8 features. buildscript { repositories { jcenter() … } dependencies { classpath ‘com.android.tools.build:gradle:<version>’ classpath ‘me.tatarka:gradle-retrolambda:<version>’ classpath ‘me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2’ } // Exclude the version that the android plugin depends on. configurations.classpath.exclude group: ‘com.android.tools.external.lombok’ } This way you can keep running lint on … Read more