Skip to content

monae/gradle-android-utils

 
 

Repository files navigation

gradle-android-utils Build Status

This is a set of utilities for Android build system.

NOTE: This project is still alpha-qality; API will be change without notice

METHODS

void iconToGrayScale(File inputFile, File outputFile)

Converts the input icon file into grayscaled one.

void copyFile(File inputFile, File outputFile, boolean toOverwrite = false)

Create outputFile from inputFile if it does not exist.

You can force overwrite with specifies the true to the 3rd argument.

void initSdkDir(Map<String, String> extra = null)

Creates local.properties if it does not exist, which includes sdk.dir, ndk.dir and extra properties.

void writeResources(File file, Map<String, String> dict)

Creates a resource XML file, which contains dict.

Version parseVersion(String versionName), Version readVersion(File versionFile)

Prases or reads a version object, which has toVersionCode() and toVersionName() methods.

void setBuildConfigField(buildType, Map<String, Object> buildConfigMap)

Set buildConfigField from Map. Requirements to 'com.android.tools.build:gradle:0.8.0' or later.

// For example

android.variantFilter{ variant ->
    def buildConfigMap = [
        'APP_NAME': 'MyApp' + variant.buildType.name.capitalize(),
        'EXTENSION_MIN_SDK_INT': 14,
        'API_SERVER_PRODUCTION': false,
    ]

    setBuildConfigField(variant.buildType, buildConfigMap)
    // or
    //setBuildConfigField(variant.flavors.get(0), buildConfigMap)
}

/**
 * //Build result
 *
 * public final class BuildConfig {
 *   ...
 *   // Fields from build type: debug
 *   public static final String APP_NAME = "MyAppDebug";
 *   public static final Integer EXTENSION_MIN_SDK_INT = 14;
 *   public static final Boolean API_SERVER_PRODUCTION = false;
 * }
 */

SEE ALSO

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms of the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 57.6%
  • Shell 42.4%