Skip to content

Instantly share code, notes, and snippets.



Last active Sep 15, 2020
What would you like to do?
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: ''

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "lt.neworld.minsdktest"
        minSdkVersion minSdk
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

And just need to pass minSdk with preferred API version. I am using most recent that my device support.


./gradlew installDebug -PminSdk=23



This solution saves me at least 40 seconds for every build, and new API lint check still works:



You can set default minSdk in global

echo 'minSdk=22' >> ~/.gradle/

This comment has been minimized.

Copy link

@tasomaniac tasomaniac commented Mar 5, 2016

For me hasProperty is not working alone, I had to use project.hasProperty


This comment has been minimized.

Copy link

@patrykpoborca patrykpoborca commented Nov 4, 2016

Thanks for the nice idea! 👍


This comment has been minimized.

Copy link

@jonathan-caryl jonathan-caryl commented Feb 10, 2017

Like @tasomaniac said, it didn't work for me unless I used project.hasProperty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment